vendredi 9 octobre 2015

Hide checkbox, but show it's content

Is it possible to hide a checkbox, but leave it's content visible?

<ListBox  
         ItemsSource ="{Binding MyItemCollection}"     
         SelectionMode="Single" 
         Width="300"
         Height="320">
      <ListBox.ItemTemplate>
          <DataTemplate>
             <CheckBox IsChecked="{Binding IsChecked}">
                   <CheckBox.Content>
                       <TextBlock Text="{Binding Item.Code}"/>
                   </CheckBox.Content>
             </CheckBox>
          </DataTemplate>
      </ListBox.ItemTemplate>
</ListBox>
<StackPanel>
   <CheckBox Content="Edit Mode" 
             IsChecked="{Binding Path=EditModeSelected, Mode=TwoWay}">
   </CheckBox>
</StackPanel>

I would like to hide the checkboxes in the list box when I turn Edit Mode off (so it should be binded to EditModeSelected), but the text should be left visible.




Aucun commentaire:

Enregistrer un commentaire