Well, I'm still not sure about the inside the then the other page , but let me try to help nonetheless.
Suppose you have something like this in your App.Xaml :
<Application.Resources> <Canvas x:Key="TestImage"> <Path Fill="#ff000000" Data="F1 M 68.240234,42.634277 L 69.554688,6.311035 L 69.414063,7.050293 C 69.665039,6.368164 70.482422,5.000000 71.210938,5.000000 L 79.306641,5.000000 C 80.060547,5.000000 80.898438,6.468750 81.104492,7.052734 L 80.963867,6.326172 L 82.497070,42.649414 L 84.995117,40.043945 L 65.742188,40.043945 L 68.240234,42.634277 ZM 87.493164,42.438477 L 85.959961,6.115234 L 85.944336,5.741211 L 85.819336,5.388672 C 85.113281,3.387207 82.946289,0.000000 79.306641,0.000000 L 71.210938,0.000000 C 67.566406,0.000000 65.401367,3.388672 64.697266,5.391113 L 64.571289,5.750000 L 64.556641,6.130371 L 63.244141,42.453613 L 63.150391,45.043945 L 65.742188,45.043945 L 84.995117,45.043945 L 87.602539,45.043945 L 87.493164,42.438477 Z"/> </Canvas> </Application.Resources>
Please note that this is the path in the canvas (so it will draw something if you put it), and the important bit is x:Key="TestImage .
Now suppose that in another place / page / control you want to use this image that you put in the above resource, all you need to do is something like:
<Grid> <ContentControl Content="{StaticResource TestImage}" /> </Grid>
And you will see your image.
You may have a definition in another xaml file, in a ResourceDictionary , just make sure you combine this dictionary into resources so that it can be found.
(It will look like this:
<Page.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="your_file_name_here.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Page.Resources>
see here for more details.
Edit: There is no key in the canvas you added ... you must have this inside the resource dictionary, and it must have the key, so you can refer to it as a StaticResource
Other editing ...
You want this code in the / usercontrol window you want to access the code in:
<Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="FolderNameHere/weight.xaml"></ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources>
(if you are in usercontrol, change Window to user control, obviously ...) Note that there is no / or \ in front of the folder name (assuming you have weight in the folder named FolderNameHere ), you will achieve it using the above code.
And yes, the code you put in the end will be in this file, and the file will look like this:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Canvas x:Key="TestCanvas" > <Path Fill="#ff000000" Data="all the points go here"/> </Canvas> </ResourceDictionary>
Only you will have something else instead of Canvas.