Forked from yoshikazuendo/WPFFocusVisualStyleSample.xaml
Created
August 20, 2025 08:49
-
-
Save myd7349/d6cd75fd4b87841b8751e54b72b05e74 to your computer and use it in GitHub Desktop.
【WPF】コントロールのフォーカスのStyleとFocusVisualStyle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- MSDN --> | |
| <!-- https://msdn.microsoft.com/ja-jp/library/bb613567(v=vs.100).aspx --> | |
| <!-- こちらも凄く参考になります。 --> | |
| <!-- http://grabacr.net/archives/464 --> | |
| <!-- フォーカス時の見た目を消す--> | |
| <TextBox Text="aikazuyendo" | |
| FocusVisualStyle="{x:Null}" /> | |
| <!-- Styleでの設定も可能なので、独自のFocusVisualStyleを作成できる。--> | |
| <Application x:Class="WpfApplication1.App" | |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| StartupUri="MainWindow.xaml"> | |
| <Application.Resources> | |
| <Style x:Key="{x:Static SystemParameters.FocusVisualStyleKey}"> | |
| <Setter Property="Control.Template"> | |
| <Setter.Value> | |
| <ControlTemplate> | |
| <Rectangle StrokeThickness="1" | |
| Stroke="Red" | |
| StrokeDashArray="3 1" | |
| SnapsToDevicePixels="true" /> | |
| </ControlTemplate> | |
| </Setter.Value> | |
| </Setter> | |
| </Style> | |
| </Application.Resources> | |
| </Application> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment