Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Parsing merged Xaml files

$
0
0

Hi,

I'm trying to parse one Xaml file, which has merged dictionaries property, which references a couple of other Xaml files.

So the file I want to parse

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"                    >    <ResourceDictionary.MergedDictionaries>        <ResourceDictionary Source="pack://application:,,,/XamlHelper;component/Resources/NestedXaml/Nested1.xaml"></ResourceDictionary>        <ResourceDictionary Source="pack://application:,,,/XamlHelper;component/Resources/NestedXaml/Nested2.xaml"></ResourceDictionary>    </ResourceDictionary.MergedDictionaries></ResourceDictionary>

What I'm doing right now (don't know if it's correct) is getting this xaml file as a string with:

var xamlToParse = System.IO.File.ReadAllText("myDir/Main.xaml");

and then:

var result = XamlReader.Parse(xamlToParse);

If I do this this way, will the parser go into my 2 merged XAML files, and parse them as well?

What would be a better way of doing this, since I want to measure the time it took for the all XAML files to parse.

Thanks.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>