Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@
Style="{StaticResource Headline}"/>
<local:CustomButton
Text="Custom Button" />
<Switch x:Name="ToggleImage" />
<Button ImageSource="settings.png">
<Button.Triggers>
<DataTrigger TargetType="Button" Binding="{Binding IsToggled, Source={x:Reference Name=ToggleImage}}" Value="True">
<Setter Property="ImageSource" Value="books.png" />
</DataTrigger>
</Button.Triggers>
</Button>
</VerticalStackLayout>
</ScrollView>
</views:BasePage.Content>
Expand Down
6 changes: 6 additions & 0 deletions src/Controls/src/Core/HandlerImpl/Button/Button.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public static void MapText(IButtonHandler handler, Button button)
public static void MapText(ButtonHandler handler, Button button) =>
MapText((IButtonHandler)handler, button);

public static void MapImageSource(IButtonHandler handler, Button button)
{
ButtonHandler.MapImageSource(handler, button);
button.Handler?.UpdateValue(nameof(Button.ContentLayout));
}

public static void MapLineBreakMode(IButtonHandler handler, Button button)
{
handler.PlatformView?.UpdateLineBreakMode(button);
Expand Down
7 changes: 7 additions & 0 deletions src/Controls/src/Core/HandlerImpl/Button/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ public partial class Button
public static IPropertyMapper<IButton, ButtonHandler> ControlsButtonMapper = new PropertyMapper<Button, ButtonHandler>(ButtonHandler.Mapper)
{
[nameof(ContentLayout)] = MapContentLayout,
#if ANDROID
[nameof(ImageSource)] = MapImageSource,
#endif
#if IOS
[nameof(Padding)] = MapPadding,
[nameof(ImageSource)] = MapImageSource,
#endif
#if MACCATALYST
[nameof(ImageSource)] = MapImageSource,
#endif
#if WINDOWS
[nameof(IText.Text)] = MapText,
Expand Down
6 changes: 6 additions & 0 deletions src/Controls/src/Core/HandlerImpl/Button/Button.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ protected override Size ArrangeOverride(Rect bounds)
public static void MapText(ButtonHandler handler, Button button) =>
MapText((IButtonHandler)handler, button);

public static void MapImageSource(IButtonHandler handler, Button button)
{
ButtonHandler.MapImageSource(handler, button);
button.Handler?.UpdateValue(nameof(Button.ContentLayout));
}

public static void MapLineBreakMode(IButtonHandler handler, Button button)
{
handler.PlatformView?.UpdateLineBreakMode(button);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,5 @@ static readonly Microsoft.Maui.Controls.TapGestureRecognizer.ButtonsProperty ->
*REMOVED*Microsoft.Maui.Controls.TapGestureRecognizer.Tapped -> System.EventHandler?
Microsoft.Maui.Controls.ILayoutManagerFactory
~Microsoft.Maui.Controls.ILayoutManagerFactory.CreateLayoutManager(Microsoft.Maui.Controls.Layout layout) -> Microsoft.Maui.Layouts.ILayoutManager
~static Microsoft.Maui.Controls.Button.MapImageSource(Microsoft.Maui.Handlers.IButtonHandler handler, Microsoft.Maui.Controls.Button button) -> void
*REMOVED*override Microsoft.Maui.Controls.RefreshView.MeasureOverride(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,5 @@ static readonly Microsoft.Maui.Controls.TapGestureRecognizer.ButtonsProperty ->
*REMOVED*Microsoft.Maui.Controls.TapGestureRecognizer.Tapped -> System.EventHandler?
Microsoft.Maui.Controls.ILayoutManagerFactory
~Microsoft.Maui.Controls.ILayoutManagerFactory.CreateLayoutManager(Microsoft.Maui.Controls.Layout layout) -> Microsoft.Maui.Layouts.ILayoutManager
~static Microsoft.Maui.Controls.Button.MapImageSource(Microsoft.Maui.Handlers.IButtonHandler handler, Microsoft.Maui.Controls.Button button) -> void
*REMOVED*override Microsoft.Maui.Controls.RefreshView.MeasureOverride(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,5 @@ static readonly Microsoft.Maui.Controls.TapGestureRecognizer.ButtonsProperty ->
*REMOVED*Microsoft.Maui.Controls.TapGestureRecognizer.Tapped -> System.EventHandler?
Microsoft.Maui.Controls.ILayoutManagerFactory
~Microsoft.Maui.Controls.ILayoutManagerFactory.CreateLayoutManager(Microsoft.Maui.Controls.Layout layout) -> Microsoft.Maui.Layouts.ILayoutManager
~static Microsoft.Maui.Controls.Button.MapImageSource(Microsoft.Maui.Handlers.IButtonHandler handler, Microsoft.Maui.Controls.Button button) -> void
*REMOVED*override Microsoft.Maui.Controls.RefreshView.MeasureOverride(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size