Skip to content

Commit

Permalink
Update CollectionView samples
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamescaper committed Jul 25, 2022
1 parent c0a2093 commit 00ae685
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
@page "/collectionviewplayground/add-remove"

<ContentPage Title="Add/Remove">
<StackLayout>
<Button Text="Add" OnClick="Add" />
<Button Text="Remove selected" OnClick="Remove" />
<Button Text="Remove all" OnClick="RemoveAll" />
<Grid RowDefinitions="Auto,*">
<VerticalStackLayout Grid.Row="0">
<Button Text="Add" OnClick="Add" />
<Button Text="Remove selected" OnClick="Remove" />
<Button Text="Remove all" OnClick="RemoveAll" />
</VerticalStackLayout>

<CollectionView ItemsSource="_intItems"
SelectionMode="SelectionMode.Single"
@bind-SelectedItem="_selectedItem">
@bind-SelectedItem="_selectedItem"
Grid.Row="1">
<EmptyView>
<Label Text="Nothing here." />
</EmptyView>
Expand All @@ -19,7 +22,7 @@
<Item Value="@context" />
</ItemTemplate>
</CollectionView>
</StackLayout>
</Grid>
</ContentPage>

@code {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
@page "/collectionviewplayground/selection"

<ContentPage Title="Selection">
<StackLayout>
<Button Text="Select Random" OnClick="SelectRandom" />
<Grid RowDefinitions="Auto,Auto,*">
<Button Text="Select Random"
OnClick="SelectRandom"
Grid.Row="0" />

<Label Text=@($"Selected Items: {(_selectedItems == null ? "" : string.Join(", ", _selectedItems))}") />
<Label Text=@($"Selected Items: {(_selectedItems == null ? "" : string.Join(", ", _selectedItems))}")
Grid.Row="1" />

<CollectionView ItemsSource="_intItems"
SelectionMode="SelectionMode.Multiple"
@bind-SelectedItems="_selectedItems">
@bind-SelectedItems="_selectedItems"
Grid.Row="2">
<ItemTemplate>
<Item Value="@context" />
</ItemTemplate>
</CollectionView>
</StackLayout>
</Grid>
</ContentPage>

@code {
Expand Down

0 comments on commit 00ae685

Please sign in to comment.