dimanche 9 octobre 2022

how to create the blue border on checkbox when mouse is over the containing element C# WPF

I have a WrapPanel containing a Label and a CheckBox; when the MouseLeftButtonUp event is triggered on the wrappanel, the checkbox is checked. The idea is to make label and the checkbox look like 1 element.

Now, the CheckBox element has this feature, that when the mouse is hovering over it, it gets surrounded by a blue border. in my case, the checkbox only takes that blue border to itself when the checkbox is directly hovered by the mouse (not the entire wrappanel). I need my checkbox to get this blue border when the mouse is over the wrappanel, not only the checkbox itself.

I tried to call the myCheckbox.Focus(); when the MouseEnter for the wrappanel is triggered, but didn't do the trick.

And I also saw this link on how to checkbox focus border apear when calling CheckBox.Focus() But it doesn't contain a solution either.

Any help is appreciated.




Aucun commentaire:

Enregistrer un commentaire