So I'm trying to implement the metro Style into my application and struggle a bit with getting it working for some specific elements.
It works for the more easy ones such as buttons or Comboboxes but not for my DataGrids or TabControls (these are MS default controls).
It should be said that most of my controls are placed in separate UserControls.
<ResourceDictionarySource="/Syncfusion.Shared.WPF;component/SkinManager/MetroStyle.xaml"/>
Some code snippets:
I've referenced the XAML resource in my App.xaml
I know it's working in general as I can apply Basedon with "MetroButtonStyle".
<Stylex:Key="MetroButtonBase"TargetType="{x:TypeButton}"BasedOn="{StaticResourceMetroButtonStyle}">
<SetterProperty="Margin"Value="5"/>
Style>
But it isn't working for "TabItem" (black foreground color).
Note: This doesn't happen when I'm removing the reference for the Metro XAML from my App.xaml?
<Stylex:Key="MetroTabItemDefault"TargetType="{x:TypeTabItem}"BasedOn="{StaticResourceMetroTabItemStyle}">
Other than that, I'm experiencing the same behavior with my DataGrids even if there Style isn't overridden (MS style shown).
<DataGridx:Name="gridProjectList"
Grid.Row="6"
Grid.RowSpan="4"
MaxColumnWidth="200"
Margin="5"IsReadOnly="True"
ColumnWidth="Auto"
GridLinesVisibility="All"
BorderBrush="{BindingElementName=gridProjectList,Path=HorizontalGridLinesBrush}"
BorderThickness="1"/>
Also I'm having a DataGrid where I'm binding the background color of the rows to a value in a different column.
I need to change the Style for this. I'm also looking for a basedon variant here as the DataGrid is showing up with the default MS style.
<DataGridx:Name="prjExcludedItems"Grid.ColumnSpan="4"Grid.RowSpan="2"MinHeight="100"Margin="5"
MaxColumnWidth="250"ColumnWidth="*"IsReadOnly="True"RowHeight="20"GridLinesVisibility="All"
BorderBrush="{BindingElementName=prjExcludedItems,Path=HorizontalGridLinesBrush}"BorderThickness="1">
<DataGrid.RowStyle>
<StyleTargetType="DataGridRow">
<Style.Triggers>
<DataTriggerBinding="{BindingPath=PrjExclItemState}"Value="new">
<SetterProperty="Background"Value="LightGreen"/>
DataTrigger>
<DataTriggerBinding="{BindingPath=PrjExclItemState}"Value="remove">
<SetterProperty="Background"Value="#FFF38484"/>
DataTrigger>
Style.Triggers>
Style>
DataGrid.RowStyle>
<DataGrid.Columns>
<DataGridTemplateColumnWidth="SizeToCells">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ImageSource="{BindingPath=PrjExclImgPath}">
Image>
DataTemplate>
DataGridTemplateColumn.CellTemplate>
DataGridTemplateColumn>
<DataGridTextColumnHeader="GUID"Width="1*">DataGridTextColumn>
<DataGridTextColumnHeader="Value"Width="3*">
<DataGridTextColumn.ElementStyle>
<StyleTargetType="TextBlock">
<SetterProperty="HorizontalAlignment"Value="Right"/>
Style>
DataGridTextColumn.ElementStyle>
DataGridTextColumn>
<DataGridTextColumnHeader="Path"Width="5*"/>
<DataGridTextColumnHeader="State"Width="*">DataGridTextColumn>
DataGrid.Columns>
DataGrid>
Someone has a clue how to achieve this?