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

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -