Now I connect the styles to the window like this:
<Window x:Class="BrainTrain.Windows.WorkWindow" 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" xmlns:local="clr-namespace:BrainTrain.Windows" mc:Ignorable="d" Title="WorkWindow" Height="482"> <Window.Resources> <Style TargetType="Ellipse"> <Setter Property="Stroke" Value="Black" /> </Style> </Window.Resources> </Window> Everything is fine, but when there are more styles, it will be inconvenient to work with them. From this follows the question. How to connect styles rendered in a separate file? I have created it, but I don’t understand where and what to register.
Here is the App.xaml
<Application x:Class="BrainTrain.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Localization/lang.xaml" /><!--Localization File--> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> Here is the path relative to the file where I want resources.
ViewResources/WorkWindowStyles.xaml