-
Notifications
You must be signed in to change notification settings - Fork 349
/
IntToBoolConverterPage.xaml
35 lines (34 loc) · 1.81 KB
/
IntToBoolConverterPage.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
<?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:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.IntToBoolConverterPage"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Converters"
x:TypeArguments="vm:IntToBoolConverterViewModel"
x:DataType="vm:IntToBoolConverterViewModel">
<pages:BasePage.Resources>
<ResourceDictionary>
<mct:IntToBoolConverter x:Key="IntToBoolConverter" />
</ResourceDictionary>
</pages:BasePage.Resources>
<pages:BasePage.Content>
<VerticalStackLayout
Padding="10,10"
HorizontalOptions="Fill"
Spacing="10"
VerticalOptions="Fill">
<Label Text="The IntToBoolConverter is a converter that allows users to convert an incoming int value to a bool. If the incoming int value is 0, it will be converted to false. Any other incoming value will be converted to true." TextColor="{StaticResource NormalLabelTextColor}" />
<Label Text="Please enter 0 for false anyting else for True" TextColor="{StaticResource NormalLabelTextColor}" />
<Entry
Placeholder="0 for false other for true"
Text="{Binding Number}"
TextColor="{StaticResource NormalLabelTextColor}" />
<Label
Padding="7,0,0,0"
Text="{Binding Path=Number, Converter={StaticResource IntToBoolConverter}}"
TextColor="{StaticResource NormalLabelTextColor}" />
</VerticalStackLayout>
</pages:BasePage.Content>
</pages:BasePage>