How to specify path for file from different project in WPF?

Posted by MartyIX on Stack Overflow See other posts from Stack Overflow or by MartyIX
Published on 2010-04-06T18:38:35Z Indexed on 2010/04/06 18:43 UTC
Read the original article Hit count: 284

Filed under:
|
|

Hello,

I've got two projects in WPF and one project is the main one and the second one is just for testing (it uses files of the main project - files are added via Project -> add -> Existing items... -> selected file -> add as link so that the file is only in the main project really).

Folders with projects are these:

C:\Work\...\Projects\Main
C:\Work\...\Projects\XXXTestProject

where XXX stands for different parts of the Main project which I test separately.

I've got the code:

<Window x:Class="Sokoban.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Sokoban"
    xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
    Title="Window1" Height="559" Width="419">
    <Window.Resources>        
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="GameDesk.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Grid>        
        <Rectangle local:GameDeskProperties.FieldSize="30" Name="myrect" Style="{DynamicResource GameDesk}" MouseEnter="Rectangle_MouseEnter" />
    </Grid>
</Window>

... which should use XAML resources from GameDesk.xaml which is in the main project and it seems that I can't use Pack URI (http://msdn.microsoft.com/en-us/library/aa970069.aspx). How can I specify the file?

  • Should I use absolute path? (C:\Work...\Main\Resources\GameDesk.xaml)

  • Or is there any other way?

Thank you for help!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about visual-studio