Custom style on Group Summary Cell based on default style
Hello,
I'm trying to create a style for the Group Summary Cell. I has able to create it following this link on the KB: https://www.syncfusion.com/kb/2485/how-to-set-the-horizontal-alignment-on-summary-columns .
The style I create is the following:
<Style x:Key="GridGroupSummaryRight"
TargetType="syncfusion:GridGroupSummaryCell">
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="FontWeight" Value="DemiBold" />
</Style>
But the style is now inconsistent with the rest of the DataGrid (using MaterialLight as theme) as shown in the following capture:
The inconsistency is on the lines (different color and lenght) and should look more like in this other capture (no custom style):
So I though about use a "BasedOn" property on the style but can't find the resource " GridGroupSummaryCellStyle".
<Style x:Key="GridGroupSummaryRight"
BasedOn="{StaticResource GridGroupSummaryCellStyle}"
TargetType="syncfusion:GridGroupSummaryCell">
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="FontWeight" Value="DemiBold" />
</Style>
Which is the base style resource name that should be used? Or which is the approach to achive the consitency with the rest of the style and only change the text alignment and font weight?
Thanks in advance.
We have reviewed your query and noticed that an incorrect key was provided for the GridGroupSummaryCell. Based on the information you provided, we have prepared a sample. We have applied a style for the GridGroupSummaryCell and used the MaterialLight theme. The styles are correctly applied when the theme is in use. We have merged the theme into the ResourceDictionary and overridden the style using the BasedOn property.
<Window.Resources> <Style TargetType="syncfusion:GridGroupSummaryCell" x:Key="customGroupSummary" BasedOn="{StaticResource SyncfusionGridGroupSummaryCellStyle}"> <Setter Property="FontWeight" Value="SemiBold"/> <Setter Property="HorizontalAlignment" Value="Right" /> </Style> </Window.Resources> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Syncfusion.Themes.MaterialLight.WPF;component/SfDataGrid/SfDataGrid.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> |
Attachment: SfDataGrid_Demo4_8_1b272508.zip
Hello,
Thank you for the guide about how to properly reference the base style to override.
Is there a place where there is a reference to all the controls styles that can be overriden? The link provided at the end shows the main style for each control, but not more details about other parts of the control that can be styled.
Thanks once again.
We have reviewed your query. Currently, we do not have a reference that demonstrates all the overridden styles for WPF controls.
- 3 Replies
- 2 Participants
-
DG David García
- Mar 13, 2025 12:53 PM UTC
- Mar 17, 2025 01:49 PM UTC