-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
ImageButtonPage.xaml
127 lines (127 loc) · 5.25 KB
/
ImageButtonPage.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<views:BasePage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Pages.ImageButtonPage"
xmlns:views="clr-namespace:Maui.Controls.Sample.Pages.Base"
Title="ImageButton">
<views:BasePage.Content>
<ScrollView>
<VerticalStackLayout
Margin="12"
Spacing="6">
<Label
Text="AspectFit"
Style="{StaticResource Headline}"/>
<ImageButton
HorizontalOptions="Center"
WidthRequest="200"
Clicked="OnImageButtonClicked"
Aspect="AspectFit"
Background="Green"
Source="cog.png"
Padding="16, 9, 16, 9" />
<Label
Text="AspectFill"
Style="{StaticResource Headline}"/>
<ImageButton
HorizontalOptions="Center"
WidthRequest="200"
HeightRequest="100"
Clicked="OnImageButtonClicked"
Aspect="AspectFill"
Background="Green"
Source="cog.png"
Padding="16, 9, 16, 9" />
<Label
Text="Fill"
Style="{StaticResource Headline}"/>
<ImageButton
HorizontalOptions="Center"
WidthRequest="200"
HeightRequest="100"
Clicked="OnImageButtonClicked"
Aspect="Fill"
Background="Green"
Source="cog.png"
Padding="16, 9, 16, 9" />
<Label
x:Name="InfoLabel"
Text="0 ImageButton clicks"
FontSize="16"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
<Label
Text="BorderColor"
Style="{StaticResource Headline}"/>
<ImageButton
Aspect="AspectFit"
Source="cog.png"
BorderColor="Red"
BackgroundColor="Green"/>
<Label
Text="BorderWidth"
Style="{StaticResource Headline}"/>
<ImageButton
Aspect="AspectFit"
Source="cog.png"
BorderColor="Red"
BorderWidth="4"
BackgroundColor="Green"/>
<Label
Text="CornerRadius = 0"
Style="{StaticResource Headline}"/>
<ImageButton
Aspect="AspectFit"
Source="cog.png"
CornerRadius="0"
BackgroundColor="Purple"/>
<Label
Text="CornerRadius = 10"
Style="{StaticResource Headline}"/>
<ImageButton
Aspect="AspectFit"
Source="cog.png"
CornerRadius="10"
BackgroundColor="Purple"/>
<Label
Text="Custom Size"
Style="{StaticResource Headline}"/>
<ImageButton
x:Name="ResizeImageButton"
Source="dotnet_bot.png"
WidthRequest="40"
HeightRequest="40"
Clicked="OnResizeImageButtonClicked"/>
<Label
Text="Using VisualStateManager"
Style="{StaticResource Headline}"/>
<ImageButton
Source="cog.png"
Background="Green"
HorizontalOptions="Center"
WidthRequest="200"
HeightRequest="100">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Property="Scale" Value="1" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Focused">
<VisualState.Setters>
<Setter Property="Scale" Value="1" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Pressed">
<VisualState.Setters>
<Setter Property="Scale" Value="0.8" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</ImageButton>
</VerticalStackLayout>
</ScrollView>
</views:BasePage.Content>
</views:BasePage>