-
Notifications
You must be signed in to change notification settings - Fork 338
/
ItemTappedEventArgsConverterPage.xaml
41 lines (36 loc) · 1.92 KB
/
ItemTappedEventArgsConverterPage.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?xml version="1.0" encoding="utf-8" ?>
<pages:BasePage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:mctBehaviors="clr-namespace:CommunityToolkit.Maui.Behaviors;assembly=CommunityToolkit.Maui"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Converters"
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.ItemTappedEventArgsConverterPage"
x:DataType="vm:ItemTappedEventArgsConverterViewModel"
x:TypeArguments="vm:ItemTappedEventArgsConverterViewModel">
<pages:BasePage.Resources>
<ResourceDictionary>
<mct:ItemTappedEventArgsConverter x:Key="ItemTappedEventArgsConverter" />
</ResourceDictionary>
</pages:BasePage.Resources>
<pages:BasePage.Content>
<VerticalStackLayout Padding="10">
<Label
Text="The ItemTappedEventArgsConverter is a converter that allows users to extract the Item value from an ItemTappedEventArgs object. It can subsequently be used in combination with EventToCommandBehavior."
TextColor="{StaticResource NormalLabelTextColor}"
Margin="0, 0, 0, 20" />
<ListView
BackgroundColor="Transparent"
ItemsSource="{Binding Items}"
SelectedItem="{Binding ItemSelected, Mode=TwoWay}">
<ListView.Behaviors>
<mctBehaviors:EventToCommandBehavior
EventName="ItemTapped"
Command="{Binding ItemTappedCommand}"
EventArgsConverter="{StaticResource ItemTappedEventArgsConverter}" />
</ListView.Behaviors>
</ListView>
</VerticalStackLayout>
</pages:BasePage.Content>
</pages:BasePage>