How can I set a TextBlock visibility inside a ListBox. For example
<Grid>
<ListBox Name="myList">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBloxk Name="txtBlock1" Text="{Binding} First Name">
<TextBloxk Name="txtBlock2" Text="{Binding} Last Name">
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
At run time, I want to set the visibility of either textblocks to either Visible or Collapsed.
How can I do that, or can I?
You can use BooleanToVisibilityConverter
(or other, custom converter) to change the Visibility according to binding value.