c# - WPF window and controls style -
i have defined in wpf application styles want apply. problem if open other window doesn't have same style of main window because defined in other project.
how can apply styles of main application?
thank you!
edit
this part of app.xaml
<application.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="assets/styles/themes/dark.xaml" /> <resourcedictionary source="assets/styles/border.xaml" /> <resourcedictionary source="assets/styles/baseblock.xaml" /> <resourcedictionary source="assets/styles/buttons.xaml" /> ..... what need apply styles defined in main project ones defined in project1 in order have uniformity.
put styles resourcedictionary of application resources in app.xaml. can use resources everywhere via {staticresource keyofyourstyle}. if want, styles applied controls of type, use default styles:
<style targettype="border" basedon="{staticresource keyofyourstyle}> <application.resources> <resourcedictionary> <thisresourcewillbeaccessedeverywhere x:key="resname"/> <resourcedictionary.mergeddictionaries> <resourcedictionary source="pack://application:,,,/yourassembley;component/resources/buttonstyles.xaml" /> </resourcedictionary.mergeddictionaries> </resourcedictionary> </application.resources> 
Comments
Post a Comment