locked
Re-use of Xaml between multiple Windows App projects not possible?

    Question

  • I am working on developing several apps for a company and would love to have a solid basis to work with xaml wise.

    I started with creating some basic styling files within a project and this makes it easy for me to control the style of the app / every element specifically.

    The next step would be to create a "styling project" which would contain most of the basic Xaml styling. Sadly i have not found any method so far to get this done. Have a missed any good walkthroughs or ideas? or is this simply not possible at this point of time?

    To be clear, I am looking for a way to share Xaml between multiple Windows Apps. Not the universal app projects for sharing between Windows and Windows Phone apps etc.

    Greetings,

    Mike

    Monday, January 05, 2015 10:09 AM

Answers

  • Hi Mike,

    URI schemes can help share resources in different store app project. You can create a library to hold those XAML styles. Please follow the steps.

    Step 1, create a library project in your solution, add resources dictionary in classlibrary project.

    Step 2, add library reference or library file to your store app or windows phone project.

    Step 3, merge resources dictionary in your store app project.

    <Page.Resources>
    
            <ResourceDictionary>
    
                <ResourceDictionary.MergedDictionaries>
    
                    <ResourceDictionary Source="ms-appx:///ClassLibrary1/Dictionary1.xaml"></ResourceDictionary>
    
                </ResourceDictionary.MergedDictionaries>
    
            </ResourceDictionary>
    
        </Page.Resources>
    
        <Grid>
    
            <Button Content="Button" Style="{StaticResource buttonstyle}" HorizontalAlignment="Left" Margin="78,105,0,0" VerticalAlignment="Top"/>
    
    </Grid>
    

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Tuesday, January 06, 2015 3:36 AM
    Moderator