Reputation: 37
I'm trying to combine multiple XAML files to make a big XAML file with different elements, how can I make that happen if I have like 10 XAML single files?
Upvotes: 0
Views: 1877
Reputation: 199
Sounds like you might want to use UserControls? E.g. you have several user controls that are just used and displayed in the main window.
Upvotes: 0
Reputation: 2136
You can merge multiple XAML file using merge distionary in App.XAML file. this will apply on all controls of the application.
like..
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="your1stXamlFile.xaml" />
<ResourceDictionary Source="Youe2ndXAMLFile.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Upvotes: 2
Reputation: 1775
Create a ResourceDictionary. You can then use the ResourceDictionary.MergedDictionaries tag.
<Application.Resources>
<ResourceDictionary>
<SolidColorBrush Color="#d0157820" x:Key="muddyBrush"/>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="firstXamlFile.xaml" />
<ResourceDictionary Source="secondXamlFile.xaml" />
<ResourceDictionary Source="anotherXamlFile.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Upvotes: 2