I have a ListBox
when one of the ListBoxItems
are selected I want to change the visibility of the button "View" and display it. Meaning that the default state is Hidden.
Is this possible and if so, do I solve this with a trigger in XAML or in code behind?
XAML Piece
<ListBox Background="Transparent"
ItemContainerStyle="{StaticResource listBoxTemplate}" BorderThickness="0">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" VerticalAlignment="Center" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Background="Beige" Margin="10 10 10 10"
HorizontalAlignment="Center" Width="500" Height="100"
VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Name="TopRow" Height="50" />
<RowDefinition Name="BottomRow" Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Name="LeftSideMenu" Width="*"/>
<ColumnDefinition Name="Middle" Width="*"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="{Binding name}" />
<Button Grid.Column="1" VerticalAlignment="Center"
Grid.RowSpan="2" Name="view" Click="viewClicked_Click"
Grid.Row="0">View</Button>
<Label Grid.Column="0" Grid.Row="1"
Content="{Binding description}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>