c# - XAML resouce dictionary - unable to apply default style -
i'm facing odd situation.
i have wpf application following lines inside app.xaml:
<application.resources>     <resourcedictionary>         <resourcedictionary.mergeddictionaries>             <resourcedictionary>                 <local:appbootstrapper x:key="bootstrapper" />             </resourcedictionary>             <resourcedictionary source="./styles/mytheme.xaml"/>         </resourcedictionary.mergeddictionaries>     </resourcedictionary> </application.resources> then have dictionaries in mytheme.xaml:
<resourcedictionary.mergeddictionaries>     <resourcedictionary source="./usercontrolstyles.xaml"/>     <resourcedictionary source="./wizardstyle.xaml"/>     <resourcedictionary source="pack://application:,,,/materialdesignthemes.wpf;component/themes/materialdesigntheme.dark.xaml" />     <resourcedictionary source="pack://application:,,,/materialdesignthemes.wpf;component/themes/materialdesigntheme.defaults.xaml" />     <resourcedictionary source="pack://application:,,,/materialdesigncolors;component/themes/recommended/primary/materialdesigncolor.blue.xaml" />     <resourcedictionary source="pack://application:,,,/materialdesigncolors;component/themes/recommended/accent/materialdesigncolor.blue.xaml" />      <resourcedictionary source="./datagridstyles.xaml"/>     <resourcedictionary source="./treeviewstyles.xaml"/>     <resourcedictionary source="./togglebuttonstyles.xaml"/> </resourcedictionary.mergeddictionaries> finally there datagrid want apply datagrids of application default (in datagridstyles.xaml):
<resourcedictionary>         <style targettype="{x:type datagrid}" basedon="{staticresource materialdesigndatagrid}">             <setter property="autogeneratecolumns" value="false" />             <setter property="canuseraddrows" value="false" />             <setter property="canuserdeleterows" value="false" />             <setter property="selectionmode" value="single" />         </style>     </resourcedictionary> the datagrid style not applying reason, works if put directly inside mytheme.xaml:
<resourcedictionary.mergeddictionaries>     <resourcedictionary source="./usercontrolstyles.xaml"/>     <resourcedictionary source="./wizardstyle.xaml"/>     <resourcedictionary source="pack://application:,,,/materialdesignthemes.wpf;component/themes/materialdesigntheme.dark.xaml" />     <resourcedictionary source="pack://application:,,,/materialdesignthemes.wpf;component/themes/materialdesigntheme.defaults.xaml" />     <resourcedictionary source="pack://application:,,,/materialdesigncolors;component/themes/recommended/primary/materialdesigncolor.blue.xaml" />     <resourcedictionary source="pack://application:,,,/materialdesigncolors;component/themes/recommended/accent/materialdesigncolor.blue.xaml" />      <resourcedictionary source="./datagridstyles.xaml"/>     <resourcedictionary source="./treeviewstyles.xaml"/>     <resourcedictionary source="./togglebuttonstyles.xaml"/>      <resourcedictionary>         <style targettype="{x:type datagrid}" basedon="{staticresource materialdesigndatagrid}">             <setter property="autogeneratecolumns" value="false" />             <setter property="canuseraddrows" value="false" />             <setter property="canuserdeleterows" value="false" />             <setter property="selectionmode" value="single" />         </style>     </resourcedictionary> </resourcedictionary.mergeddictionaries> note materialdesigndatagrid defined inside materialdesigntheme.defaults.xaml.
is expected behavior? doing wrong?
thank time.
try different settings build action of datagridstyles.xaml. think should work if set page.
Comments
Post a Comment