I have a checkbox and a textblock inside a stackpanel. When the textblock is clicked, the checkbox should be checked. Actually, it is a set of checkboxes and set of text blocks. Need to retrieve the value ID ( this is a property of the class "SomeClass" of the checkbox. But what has been binded to the Textblock is the name. My question is how do I retrieve the the whole object ?
<ListView>
<GridView>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<ItemsControl ItemSource="{Binding SomeClass} ">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<CheckBox...../>
<TextBlock ...Text={Binding Name}/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView>
I am making use of the MouseLeftButton event of TextBlock. I can retrieve the Name, but what I need is the whole obect itself so that I can retrieve the ID property . Any solution to this ?
Aucun commentaire:
Enregistrer un commentaire