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?

Replay

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

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.171 (s). 12 q(s)