首页 新闻 会员 周边

silverlight 怎么取treeview里面treeview checkbox选中的值

0
悬赏园豆:100 [已解决问题] 解决于 2012-04-18 09:49

silverlight 怎么取treeview里面treeview checkbox选中的值

silverlightwx的主页 silverlightwx | 初学一级 | 园豆:23
提问于:2012-03-30 11:43
< >
分享
最佳答案
0
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->public void checkAll_Click(object sender, RoutedEventArgs e) //checkAll is my button

{

var objects = GetChilds(MyTreeview).OfType<CheckBox>();

foreach (CheckBox d in objects)

{

d.IsChecked = true;

}

}
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->  private static IEnumerable<DependencyObject> GetChilds(DependencyObject root)
{
List<DependencyObject> lst = new List<DependencyObject>();
lst.Add(root);
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(root); i++)
lst.AddRange(GetChilds(VisualTreeHelper.GetChild(root, i)));
return lst;
}
收获园豆:100
az235 | 大侠五级 |园豆:8483 | 2012-03-30 17:01
其他回答(2)
0

http://www.cnblogs.com/z_lb/articles/1673415.html

無限遐想 | 园豆:3740 (老鸟四级) | 2012-03-30 13:19
0

'http://q.cnblogs.com/q/30634/'这个是我回答别人的WPF的,差不多吧。

悟行 | 园豆:12559 (专家六级) | 2012-03-30 17:01
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册