-
Notifications
You must be signed in to change notification settings - Fork 338
/
ImageResourceConverterPage.xaml
43 lines (41 loc) · 2.03 KB
/
ImageResourceConverterPage.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
42
43
<?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.ImageResourceConverterPage"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Converters"
x:TypeArguments="vm:ImageResourceConverterViewModel"
x:DataType="vm:ImageResourceConverterViewModel">
<ContentPage.Resources>
<ResourceDictionary>
<mct:ImageResourceConverter x:Key="ImageResourceConverter" />
</ResourceDictionary>
</ContentPage.Resources>
<pages:BasePage.Content>
<Grid RowDefinitions="100, *" ColumnDefinitions="*,50,*">
<Label Grid.ColumnSpan="3" Text="ImageResourceConverter converts embedded image resource ID to it ImageSource"
HorizontalOptions="CenterAndExpand" TextColor="{StaticResource NormalLabelTextColor}"/>
<Image Grid.Row="1"
Grid.Column="0"
Source="{Binding XamarinImageResource, Converter={StaticResource ImageResourceConverter}}"
WidthRequest="150"
HeightRequest="150"
HorizontalOptions="End"/>
<Label Grid.Row="1"
Grid.Column="1"
Text="➡️"
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="Large"
TextColor="{StaticResource NormalLabelTextColor}"/>
<Image Grid.Row="1"
Grid.Column="2"
Source="{Binding MauiImageResource, Converter={StaticResource ImageResourceConverter}}"
WidthRequest="150"
HeightRequest="150"
HorizontalOptions="Start"/>
</Grid>
</pages:BasePage.Content>
</pages:BasePage>