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

Load xaml file from another project using XamlReader

$
0
0

I have  a project say x with class Prints.xaml and button is defined as below:

 <GUIButton x:Name="CropView" BorderThickness="0" BorderColorKey="Black" ColorKey="Transparent"                        FilePath="Style.xaml"   HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0" Grid.Row="0" Grid.Column="0"      />

Other Project Y has GUIButton it refrence from other project.

GUIButton.cs has method to load xaml file called style.xaml which is defined in project Y.

if (args.NewValue != null)

            {                string filePath = args.NewValue as string;                if (!string.IsNullOrEmpty(filePath)|| File.Exists(filePath))                {                    using (FileStream stream = new FileStream(filePath, FileMode.Open))                    {                        style = XamlReader.Load(stream) as Style;                    }                }            }

When i excute the method im getting an error Style.xaml not found since it is not in Project X. 

       Now i want to open the Style.xaml from project Y which is defined on Button in Project X. 

 Any help appreciated.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



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