Click here to Skip to main content
15,886,592 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i made one project with type window app, so it has app.xml

i put application resource dictionary in it

App.XML in Project 1 with button style FontWeight Bold and Foreground Red
XML
<Application.Resources>
    <ResourceDictionary>
	<ResourceDictionary.MergedDictionaries>
        	<ResourceDictionary Source="Styles\ButtonStyle.xaml" />	
	</ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>


then i build it, and make another window app project, i copied the style and has same Resource dictionary

Project 2 has Reference Project 1

App.XML in Project 2 With FontWeight Normal and Foreground Black
XML
<Application.Resources>
    <ResourceDictionary>
	<ResourceDictionary.MergedDictionaries>
        	<ResourceDictionary Source="Styles\ButtonStyle.xaml" />	
	</ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>


Said that i have a button1 in Project 1, when in visual studio it display correctly to have Font Bold and Color Red.

in Project 2 i call the button1 in project 1, but it display Font Normal and Color Black. so the button1 use the style in project 2.

as my button1 in user control, so i move the resource definition in usercontrol.Resource, it display correctly even if i call the button1 from project 2.

but, it will be very complicated if i have many button with separate usercontrol to define the styles each user control.

so how i can make my resource defined for entire project 1, without being overwritten by project 2?

Thanks for advance.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900