-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainPage.xaml
63 lines (55 loc) · 2.66 KB
/
MainPage.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiAppImageSourceFromFileBug"
x:Class="MauiAppImageSourceFromFileBug.MainPage">
<ContentPage.Resources>
<local:NullConverter x:Key="MyNullConverter" />
</ContentPage.Resources>
<ScrollView>
<VerticalStackLayout>
<!-- Selection view: -->
<CollectionView ItemsSource="{Binding Items}"
SelectedItem="{Binding SelectedItem}"
SelectionMode="Single"
Margin="0">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Vertical"
ItemSpacing="0" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<VerticalStackLayout Padding="15"
Margin="15">
<Label Text="{Binding Name}" />
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<!-- Details view: -->
<VerticalStackLayout BindingContext="{Binding SelectedItem}">
<Label Text="SelectedItem:" />
<Label Text="{Binding Name}" />
<Image Aspect="AspectFill"
Source="{Binding ImageSource}"
Margin="0, 20, 0, 20">
<Image.Style>
<Style TargetType="Image">
<Setter Property="IsVisible"
Value="false" />
<Style.Triggers>
<!-- Workaround, because the ImageSource doesn't update after a null value is set -->
<DataTrigger TargetType="Image"
Binding="{Binding ImageSource, Converter={x:StaticResource MyNullConverter}}"
Value="false">
<Setter Property="IsVisible"
Value="true" />
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>
</ContentPage>