diff --git a/Maui.DataGrid.Sample/MainPage.xaml b/Maui.DataGrid.Sample/MainPage.xaml index 79a8839..7038c71 100644 --- a/Maui.DataGrid.Sample/MainPage.xaml +++ b/Maui.DataGrid.Sample/MainPage.xaml @@ -22,7 +22,7 @@ HeaderBackground="{StaticResource GridHeaderBgColor}" HeaderBordersVisible="{Binding HeaderBordersVisible}" BackgroundColor="{StaticResource GridBgColor}" ActiveRowColor="{StaticResource ActiveRowColor}" FooterBackground="{StaticResource GridFooterBgColor}" SortedColumnIndex="1" - PaginationEnabled="{Binding PaginationEnabled}" PageSize="{Binding PageSize}" + PaginationEnabled="{Binding PaginationEnabled}" PageSize="{Binding PageSize}" PageText="{Binding PaginationText}" PerPageText="{Binding PerPageText}" PullToRefreshCommand="{Binding Commands[Refresh]}" IsRefreshing="{Binding IsRefreshing}" RowHeight="70" HeaderHeight="75" x:Name="_dataGrid1" RowTappedCommand="{Binding Commands[Tapped]}"> diff --git a/Maui.DataGrid.Sample/ViewModels/MainViewModel.cs b/Maui.DataGrid.Sample/ViewModels/MainViewModel.cs index 5044a68..6d08d5f 100644 --- a/Maui.DataGrid.Sample/ViewModels/MainViewModel.cs +++ b/Maui.DataGrid.Sample/ViewModels/MainViewModel.cs @@ -22,6 +22,8 @@ public MainViewModel() SelectionMode = SelectionMode.Single; PageSize = 6; BorderThicknessNumeric = 2; + PaginationText = "Page: "; + PerPageText = "# per page: "; Commands.Add("CompleteEdit", new Command(CmdCompleteEdit)); Commands.Add("Edit", new Command(CmdEdit)); @@ -105,6 +107,18 @@ public bool PaginationEnabled set => SetValue(value); } + public string PaginationText + { + get => GetValue() ?? "Page:"; + set => SetValue(value); + } + + public string PerPageText + { + get => GetValue() ?? "# per page:"; + set => SetValue(value); + } + public bool RefreshingEnabled { get => GetValue(); diff --git a/Maui.DataGrid/DataGrid.xaml b/Maui.DataGrid/DataGrid.xaml index 1ef63cf..cd97f44 100644 --- a/Maui.DataGrid/DataGrid.xaml +++ b/Maui.DataGrid/DataGrid.xaml @@ -69,11 +69,11 @@ - - diff --git a/Maui.DataGrid/DataGrid.xaml.cs b/Maui.DataGrid/DataGrid.xaml.cs index 998f2e9..232d58e 100644 --- a/Maui.DataGrid/DataGrid.xaml.cs +++ b/Maui.DataGrid/DataGrid.xaml.cs @@ -205,6 +205,34 @@ public partial class DataGrid } }); + /// + /// Gets or sets the text for the page label in the DataGrid. + /// + public static readonly BindableProperty PageTextProperty = + BindablePropertyExtensions.Create( + defaultValue: "Page:", + propertyChanged: (b, _, _) => + { + if (b is DataGrid self) + { + self.OnPropertyChanged(nameof(PageText)); + } + }); + + /// + /// Gets or sets the localized text for the per page label. + /// + public static readonly BindableProperty PerPageTextProperty = + BindablePropertyExtensions.Create( + defaultValue: "# per page:", + propertyChanged: (b, _, _) => + { + if (b is DataGrid self) + { + self.OnPropertyChanged(nameof(PerPageText)); + } + }); + /// /// Gets or sets the page count for the DataGrid. /// @@ -1129,6 +1157,24 @@ private set } } + /// + /// Gets or sets the customized text for the 'Page' label in the pagination section. + /// + public string PageText + { + get => (string)GetValue(PageTextProperty); + set => SetValue(PageTextProperty, value); + } + + /// + /// Gets or sets the customized text for the 'Per Page' label in the pagination section. + /// + public string PerPageText + { + get => (string)GetValue(PerPageTextProperty); + set => SetValue(PerPageTextProperty, value); + } + internal Style DefaultHeaderLabelStyle { get; } internal Style DefaultHeaderFilterStyle { get; }