Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public override string ToString()
new GalleryPageFactory(() => new CollectionViewFeaturePage(), "CollectionView Feature Matrix"),
new GalleryPageFactory(() => new LabelControlPage(), "Label Feature Matrix"),
new GalleryPageFactory(() => new CarouselViewFeaturePage(), "CarouselView Feature Matrix"),
new GalleryPageFactory(() => new ImageButtonControlPage(), "ImageButton Feature Matrix"),
new GalleryPageFactory(() => new BoxViewControlPage(), "BoxView Feature Matrix"),
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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:Maui.Controls.Sample"
x:Class="Maui.Controls.Sample.ImageButtonControlMainPage"
x:DataType="local:ImageButtonViewModel"
Title="ImageButtonControlPage">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Options"
Clicked="NavigateToOptionsPage_Clicked"
AutomationId="Options"/>
</ContentPage.ToolbarItems>

<Grid RowDefinitions="*,Auto,Auto,Auto,Auto"
ColumnDefinitions="*" >

<ImageButton x:Name="TestImageButton"
Source="{Binding Source}"
Aspect="{Binding Aspect}"
BorderColor="{Binding BorderColor}"
BorderWidth="{Binding BorderWidth}"
CornerRadius="{Binding CornerRadius}"
IsEnabled="{Binding IsEnabled}"
Command="{Binding ImageCommand}"
CommandParameter="{Binding CommandParameter}"
Clicked="OnImageButtonClicked"
Pressed="OnImageButtonPressed"
Released="OnImageButtonReleased"
Padding="{Binding Padding}"
IsVisible="{Binding IsVisible}"
Shadow="{Binding Shadow}"
FlowDirection="{Binding FlowDirection}"
WidthRequest="350"
HeightRequest="450"
AutomationId="ImageButtonControl"/>
<Label Grid.Row="1"
Text="{Binding ClickTotal, StringFormat='ImageButton Clicked: {0}'}"
HorizontalOptions="Center"
FontSize="12"
IsVisible="{Binding IsButtonClicked}"/>
<Label Grid.Row="2"
Text="{Binding PressedTotal, StringFormat='ImageButton Pressed: {0}'}"
HorizontalOptions="Center"
FontSize="12"
IsVisible="{Binding IsButtonClicked}"/>
<Label Grid.Row="3"
Text="{Binding ReleasedTotal, StringFormat='ImageButton Released: {0}'}"
HorizontalOptions="Center"
FontSize="12"
IsVisible="{Binding IsButtonClicked}"/>
<Label Grid.Row="4"
Text="{Binding CommandResult}"
HorizontalOptions="Center"
FontSize="12"
IsVisible="{Binding IsButtonClicked}"/>
</Grid>

</ContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample;

public class ImageButtonControlPage : NavigationPage
{
private ImageButtonViewModel _viewModel;

public ImageButtonControlPage()
{
_viewModel = new ImageButtonViewModel();
PushAsync(new ImageButtonControlMainPage(_viewModel));
}
}

public partial class ImageButtonControlMainPage : ContentPage
{
private ImageButtonViewModel _viewModel;

public ImageButtonControlMainPage(ImageButtonViewModel viewModel)
{
InitializeComponent();
_viewModel = viewModel;
BindingContext = _viewModel;
}

private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e)
{
BindingContext = _viewModel = new ImageButtonViewModel();
await Navigation.PushAsync(new ImageButtonOptionsPage(_viewModel));
}

private void OnImageButtonClicked(object sender, EventArgs e)
{
_viewModel.ClickTotal++;
_viewModel.IsButtonClicked = true;
}

private void OnImageButtonPressed(object sender, EventArgs e)
{
_viewModel.PressedTotal++;
_viewModel.IsButtonClicked = true;
}

private void OnImageButtonReleased(object sender, EventArgs e)
{
_viewModel.ReleasedTotal++;
_viewModel.IsButtonClicked = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<?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"
x:Class="Maui.Controls.Sample.ImageButtonOptionsPage"
Title="ImageButtonOptionsPage">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Apply"
Clicked="ApplyButton_Clicked"/>
</ContentPage.ToolbarItems>
<Grid ColumnDefinitions="*,*"
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto"
RowSpacing="25"
ColumnSpacing="5"
Padding="20">
<VerticalStackLayout Grid.Row="0"
Grid.ColumnSpan="2">
<Label Text="Aspect"
FontSize="16"
FontAttributes="Bold"/>
<HorizontalStackLayout>
<RadioButton Content="AspectFit"
IsChecked="True"
GroupName="AspectGroup"
CheckedChanged="AspectRadio_CheckedChanged"
AutomationId="ImageAspectFit"/>
<RadioButton Content="AspectFill"
GroupName="AspectGroup"
CheckedChanged="AspectRadio_CheckedChanged"
AutomationId="ImageAspectFill"/>
<RadioButton Content="Fill"
GroupName="AspectGroup"
CheckedChanged="AspectRadio_CheckedChanged"
AutomationId="ImageFill"/>
<RadioButton Content="Center"
GroupName="AspectGroup"
CheckedChanged="AspectRadio_CheckedChanged"
AutomationId="ImageCenter"/>
</HorizontalStackLayout>
</VerticalStackLayout>
<VerticalStackLayout Grid.Row="1"
Grid.ColumnSpan="2">
<Label Text="Source Type"
FontSize="16"
FontAttributes="Bold"/>
<HorizontalStackLayout>
<RadioButton Content="File"
GroupName="SourceTypeGroup"
CheckedChanged="SourceTypeRadio_CheckedChanged"
AutomationId="SourceTypeFile"/>
<RadioButton Content="Uri"
GroupName="SourceTypeGroup"
CheckedChanged="SourceTypeRadio_CheckedChanged"
AutomationId="SourceTypeUri"/>
<RadioButton Content="Stream"
GroupName="SourceTypeGroup"
CheckedChanged="SourceTypeRadio_CheckedChanged"
AutomationId="SourceTypeStream"/>
<RadioButton Content="FontImage"
GroupName="SourceTypeGroup"
CheckedChanged="SourceTypeRadio_CheckedChanged"
AutomationId="SourceTypeFontImage"/>
</HorizontalStackLayout>
</VerticalStackLayout>
<VerticalStackLayout Grid.Row="2"
Grid.Column="0">
<Label Text="Border Width"
FontSize="16"
FontAttributes="Bold"/>
<Entry Placeholder="Enter border width"
TextChanged="BorderWidthEntry_TextChanged"
AutomationId="BorderWidthEntry"/>
</VerticalStackLayout>
<VerticalStackLayout Grid.Row="2"
Grid.Column="1">
<Label Text="Corner Radius"
FontSize="16"
FontAttributes="Bold"/>
<Entry x:Name="CornerRadiusEntry"
Placeholder="e.g. 10,20,10,20"
TextChanged="OnCornerRadiusChanged"
AutomationId="CornerRadiusEntry"/>
</VerticalStackLayout>

<VerticalStackLayout Grid.Row="3"
Grid.Column="0">
<Label Text="Is Opaque"
FontSize="16"
FontAttributes="Bold"/>
<HorizontalStackLayout>
<RadioButton Content="False"
IsChecked="True"
GroupName="OpaqueGroup"
CheckedChanged="OpaqueRadio_CheckedChanged"
AutomationId="OpaqueFalse"/>
<RadioButton Content="True"
GroupName="OpaqueGroup"
CheckedChanged="OpaqueRadio_CheckedChanged"
AutomationId="OpaqueTrue"/>
</HorizontalStackLayout>
</VerticalStackLayout>
<VerticalStackLayout Grid.Row="3"
Grid.Column="1">
<Label Text="Border Color"
FontSize="16"
FontAttributes="Bold"/>
<HorizontalStackLayout>
<RadioButton Content="Red"
GroupName="BorderColorGroup"
CheckedChanged="BorderColorRadio_CheckedChanged"
AutomationId="BorderRed"/>
<RadioButton Content="Green"
GroupName="BorderColorGroup"
CheckedChanged="BorderColorRadio_CheckedChanged"
AutomationId="BorderGreen"/>
</HorizontalStackLayout>
</VerticalStackLayout>
<VerticalStackLayout Grid.Row="4"
Grid.Column="0">
<Label Text="Flow Direction"
FontSize="16"
FontAttributes="Bold"/>
<HorizontalStackLayout>
<RadioButton x:Name="FlowDirectionLTR"
AutomationId="FlowDirectionLTR"
GroupName="FlowDirection"
Content="LTR"
IsChecked="True"
FontSize="14"
CheckedChanged="OnFlowDirectionChanged"/>
<RadioButton x:Name="FlowDirectionRTL"
AutomationId="FlowDirectionRTL"
GroupName="FlowDirection"
Content="RTL"
FontSize="14"
CheckedChanged="OnFlowDirectionChanged"/>
</HorizontalStackLayout>
</VerticalStackLayout>
<VerticalStackLayout Grid.Row="4"
Grid.Column="1">
<Label Text="Is Enabled"
FontSize="16"
FontAttributes="Bold"/>
<HorizontalStackLayout>
<RadioButton Content="True"
IsChecked="True"
GroupName="IsEnabledGroup"
CheckedChanged="IsEnabledRadio_CheckedChanged"
AutomationId="IsEnabledTrue"/>
<RadioButton Content="False"
GroupName="IsEnabledGroup"
CheckedChanged="IsEnabledRadio_CheckedChanged"
AutomationId="IsEnabledFalse"/>
</HorizontalStackLayout>
</VerticalStackLayout>
<VerticalStackLayout Grid.Row="5"
Grid.Column="0">
<Label Text="Is Visible"
FontSize="16"
FontAttributes="Bold"/>
<HorizontalStackLayout>
<RadioButton Content="True"
IsChecked="True"
GroupName="IsVisibleGroup"
CheckedChanged="IsVisibleRadio_CheckedChanged"
AutomationId="IsVisibleTrue"/>
<RadioButton Content="False"
GroupName="IsVisibleGroup"
CheckedChanged="IsVisibleRadio_CheckedChanged"
AutomationId="IsVisibleFalse"/>
</HorizontalStackLayout>
</VerticalStackLayout>
<VerticalStackLayout Grid.Row="5"
Grid.Column="1">
<Label Text="Shadow"
FontSize="16"
FontAttributes="Bold"/>
<HorizontalStackLayout>
<RadioButton Content="False"
IsChecked="True"
GroupName="ShadowGroup"
CheckedChanged="ShadowRadio_CheckedChanged"
AutomationId="ShadowFalse"/>
<RadioButton Content="True"
GroupName="ShadowGroup"
CheckedChanged="ShadowRadio_CheckedChanged"
AutomationId="ShadowTrue"/>

</HorizontalStackLayout>
</VerticalStackLayout>
<VerticalStackLayout Grid.Row="6"
Grid.Column="0">
<Label Text="Padding"
FontSize="16"
FontAttributes="Bold"/>
<Entry x:Name="PaddingEntry"
Placeholder="e.g. 10,20,10,20"
TextChanged="OnPaddingChanged"
AutomationId="PaddingEntry"/>
</VerticalStackLayout>
</Grid>
</ContentPage>
Loading