Hi I would like to know how i can separate my MainWindow.xaml into different xaml files? I would like to outsource my styles and include them whenever i need them. I searched for some solutions and found some stackoverflow posts but none of them helped me.
I would like to achieve something like this (pseudocode)
<Window x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyApp"
Title="MyApp" Height="350" Width="525">
<Window.Resources>
//Import external xaml file with textbox style here
//instead of:
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
//add code here
</Style.Triggers>
</Style>
</Window.Resources>
<StackPanel>
<TextBox Width="60"/>
<Button Content="Button" Height="23" Name="button1" Width="75" />
</StackPanel>
Create XAML
ResourceDictionaryfiles, include them like this: