How to hide item's template's subcontrol when not selected

This is the control I have bound to a collection.

<ListBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding Path=Pallets}" >     <ItemsControl.ItemTemplate>         <DataTemplate>             <DockPanel>                 <Button Content="C" DockPanel.Dock="Left"/>                 <Button Content="D" DockPanel.Dock="Right"/>                 <TextBlock Text="{Binding Path=Name}"/>             </DockPanel>         </DataTemplate>     </ItemsControl.ItemTemplate> </ListBox> 

And this is how it looks like

How to hide item's template's subcontrol when not selected

What I would like to achieve is to have the two buttons (left and right) hidden by default, but should become visible on a selected item.

I suposse, it could be done using triggers?


Category: c# Time: 2016-07-31 Views: 83
Tags: wpf mvvm

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.499 (s). 13 q(s)