Search This Blog

Mind freaker Stuff

Please Visit my new blog http://www.mindfreakerstuff.com for new articles related to web and mobile designing.

Friday, September 16, 2011

How to Disable the default Dashed Focus Rectangle on WPF Controls

When a WPF control gains the focus, it displays a dashed box around itself to indicate that it has the focus. In some cases, the focus rectangle can detract from the design of the program.

To disable this box, add the attribute FocusVisualStyle="{x:Null}" to a control.

To re-enable it, set that attribute to a Style of your choice.
example:
<Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
</Style>


-------- nJoy :-)

1 comment: