Skip to content

Commit

Permalink
set SelectionModes to static in sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Miller committed Jan 23, 2024
1 parent e8d698c commit 039a672
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Maui.DataGrid.Sample/SettingsPopup.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:Microsoft.Maui.Controls;assembly=Microsoft.Maui.Controls"
xmlns:dg="clr-namespace:Maui.DataGrid;assembly=Maui.DataGrid"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:vm="clr-namespace:Maui.DataGrid.Sample.ViewModels"
x:Class="Maui.DataGrid.Sample.SettingsPopup" Color="Black">

<toolkit:Popup.Resources>
Expand Down Expand Up @@ -34,7 +36,7 @@
<Label Text="Pagination Enabled?" TextColor="White" VerticalOptions="Center" />
</HorizontalStackLayout>
<HorizontalStackLayout Style="{StaticResource SampleContainerStyle}">
<Picker SelectedItem="{Binding SelectionMode}" ItemsSource="{Binding SelectionModes}" ItemDisplayBinding="{Binding .}" />
<Picker SelectedItem="{Binding SelectionMode}" ItemsSource="{Static vm:MainViewModel.SelectionModes}" ItemDisplayBinding="{Binding .}" />
<Label Text="Selection Mode" TextColor="White" VerticalOptions="Center" />
</HorizontalStackLayout>
<HorizontalStackLayout Style="{StaticResource SampleContainerStyle}">
Expand Down
5 changes: 4 additions & 1 deletion Maui.DataGrid.Sample/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Maui.DataGrid.Sample.ViewModels;

using System.Collections.Immutable;
using System.Collections.ObjectModel;
using Models;
using Utils;
Expand All @@ -21,9 +22,11 @@ public MainViewModel()
Commands.Add("CompleteEdit", new Command(CmdCompleteEdit));
Commands.Add("Edit", new Command<Team>(CmdEdit));
Commands.Add("Refresh", new Command(CmdRefresh));

var picker = new Picker();
}

public IEnumerable<SelectionMode> SelectionModes => Enum.GetValues<SelectionMode>().Cast<SelectionMode>();
public static ImmutableList<SelectionMode> SelectionModes => Enum.GetValues<SelectionMode>().Cast<SelectionMode>().ToImmutableList();

public ObservableCollection<DataGridColumn> Columns { get; set; }

Expand Down

0 comments on commit 039a672

Please sign in to comment.