dimanche 18 octobre 2020

Hide checkbox until mouse over WPF

New to xaml, but I would like the checkbox option to be hidden on my application until the user mouses over the row and can check the box from there. Here is what I currently have, and I'm not sure why it doesn't work. Any help would be greatly appreciated!

 <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <CheckBox Name="cbkSelect" 
                           IsChecked="{Binding Path=IsSelectedForOrder, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                            <CheckBox.Style>
                                <Style TargetType="CheckBox">
                                    <Setter Property="Visibility" Value="Hidden"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ElementName=cbkSelect, Path=IsMouseOver}" Value="True">
                                            <Setter Property="Visibility" Value="Visible"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </CheckBox.Style>
                        </CheckBox>
                    </DataTemplate>
  </DataGridTemplateColumn.CellTemplate>



Aucun commentaire:

Enregistrer un commentaire