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?
-
1Why would you want to do that?Arian Motamedi– Arian Motamedi2013-11-12 00:14:55 +00:00Commented Nov 12, 2013 at 0:14
-
Do you mean like a MergedDictionary ?clcto– clcto2013-11-12 00:15:51 +00:00Commented Nov 12, 2013 at 0:15
-
please clarify your question ... Is it data you're reading? otherwise, like @clcto said, are you looking at merging dictionaries? are you looking to have a program that copies several xmls into one?Noctis– Noctis2013-11-12 00:19:35 +00:00Commented Nov 12, 2013 at 0:19
-
Does the order matter or you want the elements to be combined?Alireza Noori– Alireza Noori2013-11-12 00:42:23 +00:00Commented Nov 12, 2013 at 0:42
Add a comment
|
3 Answers
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>
Comments
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>
Comments
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.
1 Comment
Cleptus
I would suggest you to adding some link to documentation on user controls in WPF, so OP can do some reading