How can I change the Text of a TextBlock when the selection in my ListView changes?
I don’t want do this manually…
All Items of the ListView are LogEntry’s (class)… Can I use Binding in the Text-Attribute of the TextBlock to get a specific property of the selected Item?
How can I change the Text of a TextBlock when the selection in my
Share
Yes, in fact there are multiple solutions, i give you the most “WPF” like answer, but imo also the least flexible.
First you need to set the
IsSynchronizedWithCurrentItem="True"propertyNow if you select an item, the bound CollectionView will set the item as the CurrentItem.
Now your TextBox/Block can bind to this specific item via a special binding syntax using a ‘/’.
For Example:
of course you can get a specific property from the current item via binding aswell
Hope that helps.