セットアップ
私は自分のアプリケーションのウィンドウのほとんどに適用される次のスタイルがあります:私はカスタマイズするためにそれを使用WPFボタンのフォーカススタイルが上書きされて
<ResourceDictionary x:Class="MyNamespace.ChromeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="CustomChromeTest" TargetType="{x:Type Window}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<Grid x:Name="GridMain" Background="{StaticResource MainFormColor}">
<ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
を私のウィンドウの周りのウィンドウクロム(私はその部分を削除した)ので、ウィンドウのすべての実際のコンテンツがコンテンツプレゼンターの中に入る。私はそうのように、このスタイルを使用します。
問題、通常のウィンドウで
、とき:
<Window x:Class="MyNamespace.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Window1" Height="300" Width="300"
Style="{DynamicResource CustomChromeTest}">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/WPFControlLibrary;component/Resources/ChromeWindow.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<StackPanel>
<Button Margin="5" Content="Button" Width="75"/>
<Button Margin="5" Content="Button" Width="75"/>
<Button Margin="5" Content="Button" Width="75"/>
<Button Margin="5" Content="Button" Width="75"/>
</StackPanel>
は、このXAMLは、上記のようなウィンドウを生成しますユーザーはコントロールをタブで移動しています現在のボタンが強調表示され、ユーザーに現在のボタンが表示されます。下の3番目のボタンの周りに注意してください。
何らかの理由で、私は自分のスタイルを使用し瞬間のために、この機能はを消え、ボタンにも、通常のようなユーザ缶タブものの、フォーカスを持っているの兆候はありません。これはなぜですか、どのようにしての組み込みの機能を復元できますか?
私はウィンドウとコントロールの数百数十人で、このスタイルを使用
に注意してください。コントロールにフォーカスがあるときに境界線を表示するトリガーを使用して、すべてのコントロールでスタイルを使用する必要はありません。カスタムウィンドウスタイルを適用する前に使用されていた既定の機能を復元したい。