bağlanılamıyor TreeView
denetimi var ve DataSource
öğelerine ağaç düğümleri 'IsExpanded
özelliği bağlamak istiyorum!Silverlight ağaç görünümü. "IsExpanded" özelliği
Ama bir istisna var:
System.Windows.Markup.XamlParseException occurred
Message=Set property '' threw an exception.
StackTrace:
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at SilverlightTree.BSTreeView.InitializeComponent()
at SilverlightTree.BSTreeView..ctor()
InnerException: System.NotSupportedException
Message=Cannot set read-only property ''.
StackTrace:
at MS.Internal.XamlMemberInfo.SetValue(Object target, Object value)
at MS.Internal.XamlManagedRuntimeRPInvokes.SetValue(XamlTypeToken inType, XamlQualifiedObject& inObj, XamlPropertyToken inProperty, XamlQualifiedObject& inValue)
InnerException:
iç istisna:
{System.NotSupportedException: Cannot set read-only property ''.
XAML:
<Grid x:Name="LayoutRoot">
<controls:TreeView Name="treeView" SelectedItemChanged="treeView_SelectedItemChanged"
Style="{Binding TreeViewConnectingLines}" BorderBrush="{x:Null}">
<controls:TreeView.ItemTemplate>
<toolkit:HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" Background="Transparent">
<toolkitDrag:ContextMenuService.ContextMenu>
<toolkitDrag:ContextMenu Loaded="ContextMenu_Loaded"
Opened="ContextMenu_Opened"/>
</toolkitDrag:ContextMenuService.ContextMenu>
<Image Source="{Binding Path=Type.Icon}" Width="20" Height="20" />
<TextBlock Text="{Binding Path=FullDescription}" Height="20"
TextAlignment="Center" HorizontalAlignment="Center" />
</StackPanel>
</toolkit:HierarchicalDataTemplate>
</controls:TreeView.ItemTemplate>
<controls:TreeView.ItemContainerStyle>
<Style TargetType="controls:TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsExpanded}"></Setter>
</Style>
</controls:TreeView.ItemContainerStyle>
</controls:TreeView>
</Grid>
ve veri öğeleri:
public interface INode
{
NodeType Type { get; set; }
bool IsSelected { get; set; }
bool IsExpanded { get; set; }
List<INode> Children{get;set;};
}
SDK ve Toolkit sürümü? Bu, 'IsExpanded' özelliği ile ilgili bir şey olduğuna sizi ikna eder? Eğer 'ItemContainerStyle' öğesini kaldırırsanız istisna kaçar mı? – AnthonyWJones
"ItemContainerStyle öğesini kaldırırsanız istisna ortadan kalkar mı?" Evet! istisna git! Araç Takımı: http://www.microsoft.com/silverlight/ – Evgeny