From 1b048ba7ad6973c843978842caa4114456670e52 Mon Sep 17 00:00:00 2001 From: Edward Miller Date: Tue, 12 Nov 2024 21:01:41 -0600 Subject: [PATCH] set styles to default when set to null --- Maui.DataGrid/DataGrid.xaml.cs | 9 ++++++++- Maui.DataGrid/DataGridColumn.cs | 24 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Maui.DataGrid/DataGrid.xaml.cs b/Maui.DataGrid/DataGrid.xaml.cs index 232d58e..456d73c 100644 --- a/Maui.DataGrid/DataGrid.xaml.cs +++ b/Maui.DataGrid/DataGrid.xaml.cs @@ -647,7 +647,14 @@ public partial class DataGrid { foreach (var column in self.Columns) { - column.SortingIcon.Style = n; + if (n is null) + { + column.SortingIcon.Style = self.DefaultSortIconStyle; + } + else + { + column.SortingIcon.Style = n; + } } } }); diff --git a/Maui.DataGrid/DataGridColumn.cs b/Maui.DataGrid/DataGridColumn.cs index 2fbcd91..492763f 100644 --- a/Maui.DataGrid/DataGridColumn.cs +++ b/Maui.DataGrid/DataGridColumn.cs @@ -167,7 +167,17 @@ public sealed class DataGridColumn : BindableObject, IDefinition { if (b is DataGridColumn self && self.HeaderLabel != null) { - self.HeaderLabel.Style = n; + if (n is null) + { + if (self.DataGrid is not null) + { + self.HeaderLabel.Style = self.DataGrid.DefaultHeaderLabelStyle; + } + } + else + { + self.HeaderLabel.Style = n; + } } }); @@ -180,7 +190,17 @@ public sealed class DataGridColumn : BindableObject, IDefinition { if (b is DataGridColumn self) { - self.FilterTextbox.Style = n; + if (n is null) + { + if (self.DataGrid is not null) + { + self.FilterTextbox.Style = self.DataGrid.DefaultHeaderFilterStyle; + } + } + else + { + self.FilterTextbox.Style = n; + } } });