Skip to content

Commit

Permalink
add page size to sample settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Miller committed Jan 16, 2024
1 parent 70b9466 commit 7defe65
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Maui.DataGrid.Sample/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<dg:DataGrid Grid.Row="1" ItemsSource="{Binding Teams}" SelectionEnabled="{Binding SelectionEnabled}" SelectedItem="{Binding SelectedTeam}"
RowHeight="70" HeaderHeight="50" BorderColor="{StaticResource GridBorderColor}" RowToEdit="{Binding TeamToEdit}"
HeaderBackground="{StaticResource GridHeaderBgColor}" HeaderBordersVisible="{Binding HeaderBordersVisible}"
PullToRefreshCommand="{Binding Commands[Refresh]}" IsRefreshing="{Binding IsRefreshing}" PaginationEnabled="{Binding PaginationEnabled}" PageSize="6"
PullToRefreshCommand="{Binding Commands[Refresh]}" IsRefreshing="{Binding IsRefreshing}"
PaginationEnabled="{Binding PaginationEnabled}" PageSize="{Binding PageSize}"
ActiveRowColor="{StaticResource ActiveRowColor}" FooterBackground="{StaticResource GridFooterBgColor}" x:Name="_dataGrid1">
<dg:DataGrid.Columns>
<dg:DataGridColumn Title="Logo" PropertyName="Logo" SortingEnabled="False">
Expand Down
5 changes: 5 additions & 0 deletions Maui.DataGrid.Sample/SettingsPopup.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
<CheckBox IsChecked="{Binding WonColumnVisible}" />
<Label Text="Won Column" TextColor="White" VerticalOptions="Center" />
</HorizontalStackLayout>
<HorizontalStackLayout Style="{StaticResource SampleContainerStyle}">
<Label Text="{Binding PageSize}" TextColor="White"/>
<Stepper Value="{Binding PageSize}" BackgroundColor="{OnPlatform WinUI=Gray}" />
<Label Text="Page Size" TextColor="White" VerticalOptions="Center" />
</HorizontalStackLayout>
<HorizontalStackLayout Style="{StaticResource SampleContainerStyle}">
<CheckBox IsChecked="{Binding PaginationEnabled}" />
<Label Text="Pagination Enabled?" TextColor="White" VerticalOptions="Center" />
Expand Down
7 changes: 7 additions & 0 deletions Maui.DataGrid.Sample/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public MainViewModel()
PaginationEnabled = true;
SelectionEnabled = true;
TeamColumnWidth = 70;
PageSize = 6;

Commands.Add("CompleteEdit", new Command(CmdCompleteEdit));
Commands.Add("Edit", new Command<Team>(CmdEdit));
Expand Down Expand Up @@ -59,6 +60,12 @@ public ushort TeamColumnWidth
set => SetValue(value);
}

public int PageSize
{
get => GetValue<int>();
set => SetValue(value);
}

public bool PaginationEnabled
{
get => GetValue<bool>();
Expand Down

0 comments on commit 7defe65

Please sign in to comment.