如何绑定到动态生成的TreeViewItem

thy38 2010-09-17 11:12:32
<TreeView x:Name="ProfileTreeView" ItemsSource="{Binding}" >
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:Profile}"
ItemsSource="{Binding Path=IPC}"
ItemTemplate="{StaticResource IPCEditorTemplate}">
<StackPanel Orientation="Horizontal">
<TextBlock>名称</TextBlock>
<TextBox x:Name="NameBox" Text="{Binding Path=Name}" Width="200" Loaded="NameBox_Loaded"/>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.Resources>

如上的一个TreeView,所有的子项都是绑定生成的,我现在想把子项TreeViewItem的IsExpanded属性绑定到一个对象上,不知该怎么做?
...全文
157 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jv9 2010-09-18
  • 打赏
  • 举报
回复
Silverlight使用反射实现TreeView动态导航

http://www.silverlightchina.net/html/tips/2010/0630/1364.html

[Silverlight]TreeView控件——动态加载子项

http://www.silverlightchina.net/html/tips/2010/0510/1110.html
老Key 2010-09-18
  • 打赏
  • 举报
回复
没做过这样的问题。。帮顶了。。
thy38 2010-09-18
  • 打赏
  • 举报
回复
我已经解决了,还是用的事件。跟LS们贴的差不多。
xzjxylophone 2010-09-17
  • 打赏
  • 举报
回复
参考这个?

http://www.cnblogs.com/RMay/archive/2008/08/14/1268028.html

8,757

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧