-
Notifications
You must be signed in to change notification settings - Fork 338
/
StateToBooleanConverterPage.xaml
33 lines (28 loc) · 1.46 KB
/
StateToBooleanConverterPage.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
<?xml version="1.0" encoding="utf-8" ?>
<pages:BasePage
x:Class="CommunityToolkit.Maui.Sample.StateToBooleanConverterPage"
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:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Converters"
Title="StateToBooleanConverterPage"
x:DataType="vm:StateToBooleanConverterViewModel"
x:TypeArguments="vm:StateToBooleanConverterViewModel">
<ContentPage.Resources>
<ResourceDictionary>
<mct:StateToBooleanConverter x:Key="StateToBooleanConverter" StateToCompare="Success" />
</ResourceDictionary>
</ContentPage.Resources>
<VerticalStackLayout VerticalOptions="Start" Spacing="12">
<Label HorizontalOptions="Center"
Text="The StateToBoolConverter is a one way converter that returns a boolean result based on whether the supplied value is of a specific LayoutState."/>
<Button HorizontalOptions="Center"
Command="{Binding ChangeLayoutCommand}"
Text="Change LayoutState" />
<Label
HorizontalOptions="Center"
Text="{Binding LayoutState, Converter={StaticResource StateToBooleanConverter}, StringFormat='The supplied value of LayoutState is Success: {0}'}"
VerticalOptions="Center" />
</VerticalStackLayout>
</pages:BasePage>