Hi All, i am attaching my class design and the xaml code which i am using to create a treeview item with circular reference. I am able to update the collecitons from the codebehind but unfortuntely it is not reflecting in the code behind. Please help me
in esolving this
<pre lang="c#">
public class EntityDesignElement : NotifyPropertyChangedBase
{
private string _id;
private ObservableCollection<EntityDesignElement> _children = new ObservableCollection<EntityDesignElement>();
private ObservableCollection<WrapperMetadataExtension> _extensions = new ObservableCollection<WrapperMetadataExtension>();
public ObservableCollection<WrapperMetadataExtension> Extensions
{
get { return _extensions; }
set
{
_extensions = value;
}
}
protected EntityDesignElement(EntityDesignElement parent)
{
Parent = parent;
_children.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("HasChildren"); };
_children.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("IsExtensionAddedToChildren"); };
//if (_children != null)
// _children.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("Extensions"); };
_extensions.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("IsExtensionAddedToChildren"); };
}
public EntityDesignElement(EntityDesignElement parent, EntityInfo info)
: this(parent)
{
Name = info.Name;
Type = info.Id;
ElementType = "Entity";
IsChildrenAllowed = true;
foreach (var property in info.Properties)
{
Children.Add(new EntityDesignElement(this, property));
}
}
public EntityDesignElement(EntityDesignElement parent, EntityPropertyInfo propertyInfo)
: this(parent)
{
Name = propertyInfo.Name;
ElementType = "Property";
Type = propertyInfo.DataType;
IsChildrenAllowed = (((propertyInfo.PropertyType == EntityPropertyType.Reference)
|| (propertyInfo.PropertyType == EntityPropertyType.ReferenceCollection))
&& (!IsCircularReference(Type)));
if (IsChildrenAllowed)
{
var entity = ClientConnector.Current.Metadata.GetEntity(propertyInfo.DataType);
if (entity != null)
foreach (var property in entity.Properties)
{
EntityDesignElement child = new EntityDesignElement(this, property);
//child._children.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("HasChildren"); };
//child._extensions.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("Extensions"); };
Children.Add(child);
}
}
}
public void AddExtension(EntityDesignElement parent, WrapperMetadataExtension extension)
{
Parent.Extensions.Add(extension);
}
public EntityDesignElement Parent { get; private set; }
public string Name
{
get { return _id; }
set { SetAndNotifyPropertyChanged<string>("Id", ref _id, value); }
}
public string ElementType { get; private set; }
public string Type { get; private set; }
public bool IsChildrenAllowed { get; private set; }
public bool HasChildren { get { return (_children.Count > 0); } }
//private bool _isExtensionAddedToChildren;
public bool IsExtensionAddedToChildren {
get { return (Parent.Extensions.Count>0); }
//set { _isExtensionAddedToChildren= value; }
}
public ObservableCollection<EntityDesignElement> Children { get { return _children; } }
private bool IsCircularReference(string type)
{
if (Parent == null)
return false;
if (Parent.Type.Equals(type))
return true;
return Parent.IsCircularReference(type);
}
public ObservableCollection<MetadataExtension> GetMetadataExtensions()
{
ObservableCollection<MetadataExtension> colls = new ObservableCollection<MetadataExtension>();
//foreach (WrapperMetadataExtensionCollectionCollection item in Extensions)
//{
// colls.Add(new MetadataExtension
// {
// ExtensionType=item.ExtensionType,
// Property=item.ExtensionType,
// Parameters=item.GetParameters()
// });
//}
return colls;
}
}
</pre>
<pre lang="xml">
<UserControl x:Class="CeniumDesignTool.Controls.Designer.MetadataEntityControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Utitlity="clr-namespace:CeniumDesignTool.Utilities"
xmlns:metadata="clr-namespace:Cenium.Framework.Client.Application.ResourceModel.Metadata;assembly=Cenium.Framework.Client.Resources"
mc:Ignorable="d" x:Name="MetadataEntityControlRoot"
d:DesignHeight="300" d:DesignWidth="300">
<Grid x:Name="LayoutRoot" DataContext="{Binding ElementName=MetadataEntityControlRoot}">
<Grid.Resources>
<Utitlity:ExtensionConverter x:Key="extConverter"/>
<Style TargetType="TextBlock" x:Key="txtEntityInfoStyle">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Utitlity:MetadataTemplateSeletor x:Key="TempSelector"/>
<BitmapImage x:Key="imgLock" UriSource="pack://application:,,,/Resources/Images/lock.png" />
<BitmapImage x:Key="imgExtension" UriSource="pack://application:,,,/Resources/Images/extension.png" />
<HierarchicalDataTemplate x:Key="MetadataEntityParentTemplate" ItemTemplateSelector="{StaticResource ResourceKey=TempSelector}">
<!-- bind the different data sources -->
<HierarchicalDataTemplate.ItemsSource>
<MultiBinding Converter="{StaticResource extConverter}">
<Binding Path="Children" UpdateSourceTrigger="PropertyChanged"/>
<Binding Path="Extensions" UpdateSourceTrigger="PropertyChanged"/>
</MultiBinding>
</HierarchicalDataTemplate.ItemsSource>
<Border BorderBrush="Black" Margin="2,2,2,2" BorderThickness="1" CornerRadius="17" Background="Gray" Padding="0,0,5,0">
<Grid Width="Auto" MinWidth="200">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="1" Text="{Binding Type}"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" />
<Rectangle Grid.Column="2" Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right" VerticalAlignment="Center">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgLock}"/>
</Rectangle.Fill>
</Rectangle>
</Grid>
</Border>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate x:Key="MeatadataEntityExtensions" ItemsSource="{Binding Path=Parameters}">
<!--ItemsSource= "{Binding Path=Parameters}"-->
<Grid Width="250">
<Border BorderBrush="Black" BorderThickness="1" CornerRadius="17" Margin="2,2,2,2" Padding="0,0,5,0" Background="LightGreen">
<StackPanel Width="auto" MinWidth="200" Orientation="Horizontal">
<TextBlock Margin="5" Text="{Binding ExtensionType, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" ></TextBlock>
<TextBlock Margin="5" Text="{Binding Property}" VerticalAlignment="Center" Grid.Column="1" Style="{StaticResource txtEntityInfoStyle}" ></TextBlock>
<Rectangle Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgExtension}"/>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Border>
</Grid>
<!--<HierarchicalDataTemplate.ItemTemplate>
<HierarchicalDataTemplate >
<Border BorderBrush="Black" BorderThickness="1" CornerRadius="17" Margin="2,2,2,2" Padding="0,0,5,0" Background="LightGreen">
<StackPanel Width="auto" MinWidth="250" Orientation="Horizontal">
<TextBlock Margin="5" Text="{Binding ExtensionType}" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" ></TextBlock>
<TextBlock Margin="5" Text="{Binding Value}" Style="{StaticResource txtEntityInfoStyle}" ></TextBlock>
<TextBlock Margin="5" Text=" : " Style="{StaticResource txtEntityInfoStyle}" />
<TextBlock Margin="5" Text="{Binding ValueType}" Style="{StaticResource txtEntityInfoStyle}" />
<Rectangle Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgExtension}"/>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Border>
</HierarchicalDataTemplate>
</HierarchicalDataTemplate.ItemTemplate>-->
</HierarchicalDataTemplate>
<DataTemplate x:Key="MeatadataEntityProperties">
<Border BorderBrush="Black" BorderThickness="1" CornerRadius="17" Padding="0,0,0,0" Background="Gray" Margin="2,2,2,2">
<!--<StackPanel Width="200" Orientation="Horizontal">
<TextBlock Margin="5" Text="{Binding Value}" ></TextBlock>
<TextBlock Margin="5" Text=" : "/>
<TextBlock Margin="5" Text="{Binding ValueType}"/>
<Rectangle Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right">
<Rectangle.Fill>
<ImageBrush ImageSource="lock.png"/>
</Rectangle.Fill>
</Rectangle>
</StackPanel>-->
<Grid Width="auto" MinWidth="200" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Margin="20,0,0,0" Text="{Binding Name}" Style="{StaticResource txtEntityInfoStyle}"></TextBlock>
<TextBlock Grid.Column="1" Margin="0" Text=" : " Style="{StaticResource txtEntityInfoStyle}"/>
<TextBlock Grid.Column="2" Margin="0" Text="{Binding PropertyType}" Style="{StaticResource txtEntityInfoStyle}"/>
<TextBlock Grid.Column="3" Margin="0" Text=" ( " Style="{StaticResource txtEntityInfoStyle}"/>
<TextBlock Grid.Column="4" Margin="0" Text="{Binding Reference}" Style="{StaticResource txtEntityInfoStyle}"/>
<TextBlock Grid.Column="5" Margin="0" Text=" ) " Style="{StaticResource txtEntityInfoStyle}"/>
<Rectangle Grid.Column="6" Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgLock}"/>
</Rectangle.Fill>
</Rectangle>
</Grid>
</Border>
</DataTemplate>
<HierarchicalDataTemplate x:Key="ClassReferenceMetadataEntity" ItemsSource="{Binding Path=Children}">
<Border BorderBrush="Black" Margin="2,2,2,2" BorderThickness="1" CornerRadius="17" Background="Gray" Padding="0,0,0,0">
<Grid Width="Auto" MinWidth="200">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" Grid.Column="0"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" />
<TextBlock Text=":" Grid.Column="1"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" />
<TextBlock Text="{Binding Type}" Grid.Column="2"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" />
</Grid>
<Rectangle Grid.Column="2" Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right" VerticalAlignment="Center">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgLock}"/>
</Rectangle.Fill>
</Rectangle>
</Grid>
</Border>
</HierarchicalDataTemplate>
</Grid.Resources>
<TreeView x:Name="ListViewExtensionTypesDesign" AllowDrop="True" Width="auto" Height="auto" ItemsSource="{Binding}" ItemTemplate="{StaticResource MetadataEntityParentTemplate}" TreeViewItem.Selected="ListViewExtensionTypesDesign_Selected">
<!--<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<EventSetter Event="TreeViewItem.DragOver" Handler="treeView_DragOver"/>
<EventSetter Event="TreeViewItem.Drop" Handler="treeView_Drop"/>
<EventSetter Event="TreeViewItem.MouseMove" Handler="treeView_MouseMove"/>
<EventSetter Event="TreeViewItem.MouseDown" Handler="treeView_MouseDown"/>
</Style>
</TreeView.ItemContainerStyle>-->
</TreeView>
<!--TreeViewItem.Selected="ListViewExtensionTypesDesign_Selected" ItemTemplate="{StaticResource MetadataEntityParentTemplate}" ItemContainerStyle="{DynamicResource TreeViewItemStyle1}" BorderBrush="{x:Null}" BorderThickness="0" Style="{DynamicResource TreeViewStyle1}"-->
</Grid>
</UserControl>
</pre>
<pre lang="c#">
public class EntityDesignElement : NotifyPropertyChangedBase
{
private string _id;
private ObservableCollection<EntityDesignElement> _children = new ObservableCollection<EntityDesignElement>();
private ObservableCollection<WrapperMetadataExtension> _extensions = new ObservableCollection<WrapperMetadataExtension>();
public ObservableCollection<WrapperMetadataExtension> Extensions
{
get { return _extensions; }
set
{
_extensions = value;
}
}
protected EntityDesignElement(EntityDesignElement parent)
{
Parent = parent;
_children.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("HasChildren"); };
_children.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("IsExtensionAddedToChildren"); };
//if (_children != null)
// _children.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("Extensions"); };
_extensions.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("IsExtensionAddedToChildren"); };
}
public EntityDesignElement(EntityDesignElement parent, EntityInfo info)
: this(parent)
{
Name = info.Name;
Type = info.Id;
ElementType = "Entity";
IsChildrenAllowed = true;
foreach (var property in info.Properties)
{
Children.Add(new EntityDesignElement(this, property));
}
}
public EntityDesignElement(EntityDesignElement parent, EntityPropertyInfo propertyInfo)
: this(parent)
{
Name = propertyInfo.Name;
ElementType = "Property";
Type = propertyInfo.DataType;
IsChildrenAllowed = (((propertyInfo.PropertyType == EntityPropertyType.Reference)
|| (propertyInfo.PropertyType == EntityPropertyType.ReferenceCollection))
&& (!IsCircularReference(Type)));
if (IsChildrenAllowed)
{
var entity = ClientConnector.Current.Metadata.GetEntity(propertyInfo.DataType);
if (entity != null)
foreach (var property in entity.Properties)
{
EntityDesignElement child = new EntityDesignElement(this, property);
//child._children.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("HasChildren"); };
//child._extensions.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs args) { OnPropertyChanged("Extensions"); };
Children.Add(child);
}
}
}
public void AddExtension(EntityDesignElement parent, WrapperMetadataExtension extension)
{
Parent.Extensions.Add(extension);
}
public EntityDesignElement Parent { get; private set; }
public string Name
{
get { return _id; }
set { SetAndNotifyPropertyChanged<string>("Id", ref _id, value); }
}
public string ElementType { get; private set; }
public string Type { get; private set; }
public bool IsChildrenAllowed { get; private set; }
public bool HasChildren { get { return (_children.Count > 0); } }
//private bool _isExtensionAddedToChildren;
public bool IsExtensionAddedToChildren {
get { return (Parent.Extensions.Count>0); }
//set { _isExtensionAddedToChildren= value; }
}
public ObservableCollection<EntityDesignElement> Children { get { return _children; } }
private bool IsCircularReference(string type)
{
if (Parent == null)
return false;
if (Parent.Type.Equals(type))
return true;
return Parent.IsCircularReference(type);
}
public ObservableCollection<MetadataExtension> GetMetadataExtensions()
{
ObservableCollection<MetadataExtension> colls = new ObservableCollection<MetadataExtension>();
//foreach (WrapperMetadataExtensionCollectionCollection item in Extensions)
//{
// colls.Add(new MetadataExtension
// {
// ExtensionType=item.ExtensionType,
// Property=item.ExtensionType,
// Parameters=item.GetParameters()
// });
//}
return colls;
}
}
</pre>
<pre lang="xml">
<UserControl x:Class="CeniumDesignTool.Controls.Designer.MetadataEntityControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Utitlity="clr-namespace:CeniumDesignTool.Utilities"
xmlns:metadata="clr-namespace:Cenium.Framework.Client.Application.ResourceModel.Metadata;assembly=Cenium.Framework.Client.Resources"
mc:Ignorable="d" x:Name="MetadataEntityControlRoot"
d:DesignHeight="300" d:DesignWidth="300">
<Grid x:Name="LayoutRoot" DataContext="{Binding ElementName=MetadataEntityControlRoot}">
<Grid.Resources>
<Utitlity:ExtensionConverter x:Key="extConverter"/>
<Style TargetType="TextBlock" x:Key="txtEntityInfoStyle">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Utitlity:MetadataTemplateSeletor x:Key="TempSelector"/>
<BitmapImage x:Key="imgLock" UriSource="pack://application:,,,/Resources/Images/lock.png" />
<BitmapImage x:Key="imgExtension" UriSource="pack://application:,,,/Resources/Images/extension.png" />
<HierarchicalDataTemplate x:Key="MetadataEntityParentTemplate" ItemTemplateSelector="{StaticResource ResourceKey=TempSelector}">
<!-- bind the different data sources -->
<HierarchicalDataTemplate.ItemsSource>
<MultiBinding Converter="{StaticResource extConverter}">
<Binding Path="Children" UpdateSourceTrigger="PropertyChanged"/>
<Binding Path="Extensions" UpdateSourceTrigger="PropertyChanged"/>
</MultiBinding>
</HierarchicalDataTemplate.ItemsSource>
<Border BorderBrush="Black" Margin="2,2,2,2" BorderThickness="1" CornerRadius="17" Background="Gray" Padding="0,0,5,0">
<Grid Width="Auto" MinWidth="200">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="1" Text="{Binding Type}"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" />
<Rectangle Grid.Column="2" Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right" VerticalAlignment="Center">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgLock}"/>
</Rectangle.Fill>
</Rectangle>
</Grid>
</Border>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate x:Key="MeatadataEntityExtensions" ItemsSource="{Binding Path=Parameters}">
<!--ItemsSource= "{Binding Path=Parameters}"-->
<Grid Width="250">
<Border BorderBrush="Black" BorderThickness="1" CornerRadius="17" Margin="2,2,2,2" Padding="0,0,5,0" Background="LightGreen">
<StackPanel Width="auto" MinWidth="200" Orientation="Horizontal">
<TextBlock Margin="5" Text="{Binding ExtensionType, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" ></TextBlock>
<TextBlock Margin="5" Text="{Binding Property}" VerticalAlignment="Center" Grid.Column="1" Style="{StaticResource txtEntityInfoStyle}" ></TextBlock>
<Rectangle Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgExtension}"/>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Border>
</Grid>
<!--<HierarchicalDataTemplate.ItemTemplate>
<HierarchicalDataTemplate >
<Border BorderBrush="Black" BorderThickness="1" CornerRadius="17" Margin="2,2,2,2" Padding="0,0,5,0" Background="LightGreen">
<StackPanel Width="auto" MinWidth="250" Orientation="Horizontal">
<TextBlock Margin="5" Text="{Binding ExtensionType}" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" ></TextBlock>
<TextBlock Margin="5" Text="{Binding Value}" Style="{StaticResource txtEntityInfoStyle}" ></TextBlock>
<TextBlock Margin="5" Text=" : " Style="{StaticResource txtEntityInfoStyle}" />
<TextBlock Margin="5" Text="{Binding ValueType}" Style="{StaticResource txtEntityInfoStyle}" />
<Rectangle Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgExtension}"/>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Border>
</HierarchicalDataTemplate>
</HierarchicalDataTemplate.ItemTemplate>-->
</HierarchicalDataTemplate>
<DataTemplate x:Key="MeatadataEntityProperties">
<Border BorderBrush="Black" BorderThickness="1" CornerRadius="17" Padding="0,0,0,0" Background="Gray" Margin="2,2,2,2">
<!--<StackPanel Width="200" Orientation="Horizontal">
<TextBlock Margin="5" Text="{Binding Value}" ></TextBlock>
<TextBlock Margin="5" Text=" : "/>
<TextBlock Margin="5" Text="{Binding ValueType}"/>
<Rectangle Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right">
<Rectangle.Fill>
<ImageBrush ImageSource="lock.png"/>
</Rectangle.Fill>
</Rectangle>
</StackPanel>-->
<Grid Width="auto" MinWidth="200" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Margin="20,0,0,0" Text="{Binding Name}" Style="{StaticResource txtEntityInfoStyle}"></TextBlock>
<TextBlock Grid.Column="1" Margin="0" Text=" : " Style="{StaticResource txtEntityInfoStyle}"/>
<TextBlock Grid.Column="2" Margin="0" Text="{Binding PropertyType}" Style="{StaticResource txtEntityInfoStyle}"/>
<TextBlock Grid.Column="3" Margin="0" Text=" ( " Style="{StaticResource txtEntityInfoStyle}"/>
<TextBlock Grid.Column="4" Margin="0" Text="{Binding Reference}" Style="{StaticResource txtEntityInfoStyle}"/>
<TextBlock Grid.Column="5" Margin="0" Text=" ) " Style="{StaticResource txtEntityInfoStyle}"/>
<Rectangle Grid.Column="6" Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgLock}"/>
</Rectangle.Fill>
</Rectangle>
</Grid>
</Border>
</DataTemplate>
<HierarchicalDataTemplate x:Key="ClassReferenceMetadataEntity" ItemsSource="{Binding Path=Children}">
<Border BorderBrush="Black" Margin="2,2,2,2" BorderThickness="1" CornerRadius="17" Background="Gray" Padding="0,0,0,0">
<Grid Width="Auto" MinWidth="200">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" Grid.Column="0"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" />
<TextBlock Text=":" Grid.Column="1"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" />
<TextBlock Text="{Binding Type}" Grid.Column="2"
Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource txtEntityInfoStyle}" />
</Grid>
<Rectangle Grid.Column="2" Height="20" Width="20" Margin="5" Stroke="Black" HorizontalAlignment="Right" VerticalAlignment="Center">
<Rectangle.Fill>
<ImageBrush ImageSource="{StaticResource imgLock}"/>
</Rectangle.Fill>
</Rectangle>
</Grid>
</Border>
</HierarchicalDataTemplate>
</Grid.Resources>
<TreeView x:Name="ListViewExtensionTypesDesign" AllowDrop="True" Width="auto" Height="auto" ItemsSource="{Binding}" ItemTemplate="{StaticResource MetadataEntityParentTemplate}" TreeViewItem.Selected="ListViewExtensionTypesDesign_Selected">
<!--<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<EventSetter Event="TreeViewItem.DragOver" Handler="treeView_DragOver"/>
<EventSetter Event="TreeViewItem.Drop" Handler="treeView_Drop"/>
<EventSetter Event="TreeViewItem.MouseMove" Handler="treeView_MouseMove"/>
<EventSetter Event="TreeViewItem.MouseDown" Handler="treeView_MouseDown"/>
</Style>
</TreeView.ItemContainerStyle>-->
</TreeView>
<!--TreeViewItem.Selected="ListViewExtensionTypesDesign_Selected" ItemTemplate="{StaticResource MetadataEntityParentTemplate}" ItemContainerStyle="{DynamicResource TreeViewItemStyle1}" BorderBrush="{x:Null}" BorderThickness="0" Style="{DynamicResource TreeViewStyle1}"-->
</Grid>
</UserControl>
</pre>