I have an xaml with this structure
<Grid>
<TreeView ItemsSource="{Binding Source={StaticResource xmlData},XPath=//@Name}">
<TreeView.ItemTemplate>
<DataTemplate>
<CheckBox Name="Check1">
<TreeViewItem Header="{Binding XPath.}"/>
</CheckBox>
</DataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Grid>
that I am attempting to add a handler to with the code
$var_Check1.addhandler([System.Windows.Controls.Checkbox]::CheckedEvent,$check_checked)
Note: I have all of my variable set to var_ when they are captured from the xaml, hence the discrepancy
The idea and thought behind this entire program is to have the treeview with checkboxes so I can perform an action on only the selected items. The code for the xml is
<Foods>
<UnhealthyFoods Name ="Candy"/>
<Food Foodname = "MMs" >
</Food>
<Food Foodname = "Skittles" >
</Food>
<Food Foodname = "Starburst" >
</Food>
</UnhealthyFoods>
<HealthyFoods>
<FoodGroup1 Name ="Vegetables"/>
<Food Foodname = "Spinach" >
</Food>
<Food Foodname = "Brocolli" >
</Food>
<Food Foodname = "Greens" >
</Food>
</FoodGroup1>
</HealthyFoods>
<HealthyFoods>
<FoodGroup2 Name ="Fruits"/>
<Food Foodname = "Apples" >
</Food>
<Food Foodname = "Pears" >
</Food>
<Food Foodname = "Cherries" >
</Food>
</FoodGroup2>
</HealthyFoods>
</Foods>
So the three checkboxes should show up as (pretend these are checkboxes)
- Candy
- Vegetables
- Fruit
Ideally I click a button that performs an action on the selected groups, alas I can't make it that far
Aucun commentaire:
Enregistrer un commentaire