mardi 20 octobre 2020

Hide checkbox until mouseover and make it stay once checked WPF

The checkbox is invisible until I mouse over which is what I want, but now I want it to stay visible once it is checked. I've tried implementing a multi trigger, but it doesn't seem to be working:

<DataGridTemplateColumn.CellTemplate>
   <DataTemplate>
      <CheckBox Name="cbkSelect" 
                IsChecked="{Binding Path=IsSelectedForOrder, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
         <CheckBox.Style>
            <Style TargetType="{x:Type CheckBox}">
               <Setter Property="Visibility" Value="Hidden"/>
               <Style.Triggers>
                  <MultiDataTrigger>
                     <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" Value="True"></Condition>
                        <Condition Binding="{Binding IsChecked, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" Value="True"></Condition>
                     </MultiDataTrigger.Conditions>
                     <MultiDataTrigger.Setters>
                        <Setter Property="Visibility" Value="Visible"/>
                     </MultiDataTrigger.Setters>
                  </MultiDataTrigger>
               </Style.Triggers>
            </Style>
         </CheckBox.Style>
      </CheckBox>
   </DataTemplate>
</DataGridTemplateColumn.CellTemplate>



Aucun commentaire:

Enregistrer un commentaire