Question

I have the following XAML for a custom DataGrid:

<Controls:ResourceDataGrid 
    x:Name="resourceDataGrid" 
    AutoGenerateColumns="false" 
    Style="{StaticResource MetroDataGrid}" 
    ItemsSource="{Binding Path=Resources, 
                          Mode=TwoWay,
                          UpdateSourceTrigger=PropertyChanged, 
                          IsAsync=True}" 
    ...
    AttachedCommand:CommandBehavior.Event="CellEditEnding"
    AttachedCommand:CommandBehavior.Command="{Binding DynamicColumnTargetChangedCommand}">
    ...
</Controls:ResourceDataGrid>

I am styling the control according to MahAppsMetro and the grid looks great. However, when I change the applications 'theme'/'accent' all windows change color and all MahAppsMetro controls also change but the DataGrid that I have detailed above does not.

The DataGrid is styled as a MetroDataGrid, so why isn't this control being updated, and what do I have to do to get it to update the 'theme'/'accent' color for this control?

Thanks for your time.

Was it helpful?

Solution

Themes only work on CustomControls. In order to provide different 'skins' for controls, you need to have a CustomControlLibrary project with a XAML file named generic.xaml.

You can find a short basic description in the Themes/generic.xaml page on Martins' 10 blog, or if you prefer more depth, you can find a complete description in the Control Authoring Overview page on MSDN.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top