This question is locked. New answers and comments are not allowed.
What I did was I copied the style file from SummerGridViewRow.xaml, then I modified it (basically just remove the gradient background and make the border on selected item thicker) and put it in my project. That worked as expected on gridview that does not use the any StyleSelector.
The problem is when I use a StyleSelector, it seems that my customization is gone and it will just use the default style for that theme (in my case, summer with background ). I supposed the line var style = new Style(typeofGridViewRow) was getting the default style from the assembly instead of my customization. My selector look like this:
My CustomGridView.xaml (remove a lot of line for space saving). The file is included in App.xaml as merged resource dictionary:
How do I make it so that, when using a style selector it will return my customized style?
The problem is when I use a StyleSelector, it seems that my customization is gone and it will just use the default style for that theme (in my case, summer with background ). I supposed the line var style = new Style(typeofGridViewRow) was getting the default style from the assembly instead of my customization. My selector look like this:
public override Style SelectStyle(object item, DependencyObject container) { var style = new Style(typeof(GridViewRow)); var row = (GridViewRow)container; var obj = item as something; if (somecondition) style.Setters.Add(new Setter(GridViewRow.BackgroundProperty, new SolidColorBrush(Color.FromArgb(255, 245, 208, 206)))); return style; }My CustomGridView.xaml (remove a lot of line for space saving). The file is included in App.xaml as merged resource dictionary:
<SolidColorBrush x:Key="GridView_RowIndicatorCellBackground_Selected" Color="#FFF5F6F8"/> <SolidColorBrush x:Key="ItemOuterBorder_Over" Color="#FFC2DAE3" /> <LinearGradientBrush x:Key="ItemInnerBorder_Over" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFE7F3F8" Offset="0"/> <GradientStop Color="#FFD4E7EE" Offset="1"/> </LinearGradientBrush> <SolidColorBrush x:Key="ItemBackground_Over" Color="#FFE7F3F8" /> <!--<GradientStop Color="#FFE7F3F8" Offset="0"/> <GradientStop Color="#FFD4E7EE" Offset="1"/>--> --- many other lines regarding colors --- <telerik:BooleanToOpacityConverter x:Key="BooleanToOpacityConverter" /> <telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <grid:GridLineWidthToThicknessConverter x:Key="GridLineWidthToThicknessConverter" /> <ControlTemplate x:Key="GridViewRowTemplate" TargetType="grid:GridViewRow">---- control template ---- </ControlTemplate>How do I make it so that, when using a style selector it will return my customized style?