Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Getting Checked Value of Checkbox on TreeViewItem

$
0
0

I have a treeview, where in I am using stackpanel to bind a checkbox to the treeviewitems. I am doing it like this:

TreeViewItem tvi =newTreeViewItem();
tvi.Header= createStackPanel();
tvi.Tag=<stringas tag>;
tvi.Items.Add(dummyNode);
myTreeview.Items.Add(tvi);

createStackPanel function is implemented like this:

privateStackPanel createStackPanel(){StackPanel pan =newStackPanel();CheckBox cb =newCheckBox();
   pan.Orientation=Orientation.Horizontal;
   pan.Children.Add(cb);return pan;}

My question is, now that I have checkboxes on my treeviewitems, how will I get the check values of each checkbox? Or how will I keep track of which checkboxes are checked?

Thanks in advance!


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>