c# - How to set style checkbox/radiobutton when checkbox/radiobutton is focused? -
i want set border checkbox/radiobutton when focused. here code! thanks
uielement element = container; dependencyobject obj2 = focusmanager.getisfocusscope(element) ? element : focusmanager.getfocusscope(element); iinputelement focusedelement = focusmanager.getfocusedelement(obj2); object obj = focusedelement; if (obj != null && (obj.gettype() == typeof(checkbox) || obj.gettype() == typeof(radiobutton))) { //set style when focus checkbox, radiobutton. }
here code
if (obj != null && (obj.gettype() == typeof(checkbox) || obj.gettype() == typeof(radiobutton))) { var element = obj frameworkelement; // element.style = resources["resourcename"] style; // or // element.style = (style) findresource("yourresourcekey"); }
i commented out line these ways set style if defined in resources.
Comments
Post a Comment