C# WPF Как применить тему из словаря ресурсов (ResourceDictionary) ко всем элемента окна/проекта

есть тема, файл UIDictionary.xaml:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="ButtonStyle"  TargetType = "Button">
    <Setter Property="Background" Value=  "Red" />
</Style>

В файле App.xaml подключаем к проекту

<Application x:Class="WpfAppBizness.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:WpfAppBizness"
         StartupUri="MainWindow.xaml">
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="UIDictionary.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

Почему стиль автоматически не применяется к кнопке в Windows??? ведь там указано TargetType = "Button"?????? т.е. такое не работает:

<Button Content="Button" HorizontalAlignment="Center" VerticalAlignment="Center" 
            Click="Button_Click"/>

Но, если прописать Style="{StaticResource ButtonStyle}", стиль сразу подхватывается

<Button Content="Button" HorizontalAlignment="Center" VerticalAlignment="Center" 
            Click="Button_Click" Style="{StaticResource ButtonStyle}"/>

такое же поведение и при подключении темы к Windows (вместо файле App.xaml):

<Window.Resources>
    <ResourceDictionary Source="UIDictionary.xaml" />
</Window.Resources>

Ответы (0 шт):