'DotBorder'에 해당되는 글 1건

  1. 2008/12/23 Remove dot border around selected Control
WPF2008/12/23 02:25
안녕하세요. 이번시간에는 아래그림과 같이 WPF Control에서 선택되었을 때 생기는 점선으로된 테두리를 없애는 방법에 대하여 소개하려고합니다. 너무나도 간단한 내용이기에 포스팅을 해야하나 고민하다가 작업시 매번 접하는 문제일 뿐더러 많은 사람들이 궁금해 하는 부분인지라 포스팅을 합니다.


위 사진은 아래와 같은 XAML코드로 제작 되었습니다. 아무것도 없습니다 -_-그냥 Gird에 Button하나 올린것 뿐이죠..

<WINDOW title="WPF Korea - whatisthat.co.kr" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" SizeToContent="WidthAndHeight" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Wit.MainWindow">
    <GRID Margin="10" Height="300" Width="300">
        <BUTTON Height="100" Width="200" Content="WPF KOREA" />
    </GRID>
</WINDOW
그럼 코드를 아래와 같이 조금만 수정해 보도록 하겠습니다.

<WINDOW title="WPF Korea - whatisthat.co.kr" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" SizeToContent="WidthAndHeight" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Wit.MainWindow">
    <GRID Margin="10" Height="300" Width="300">
        <BUTTON Height="100" Width="200" Content="WPF KOREA" FocusVisualStyle="{x:Null}">
    </GRID>
</WINDOW
Button의 FocusVisualStyle속성을 Null로 지정했습니다. 그럼 결과를 보겠습니다.


짜잔~~ -_- ;; 테두리가 사라졌습니다!! 단순하게 하려면 위와 같은 방법으로도 해결 할 수 있지만, Application 전체에 걸쳐서 적용시키고자한다면 이전에 소개해드렸던 Overriding default SystemColors를 참고하셔서 해결하실 수도 있습니다.
언제나 그랬듯이 질문은 메일이나 리플로 남겨주세요~



크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 곡스