diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18242.xaml b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18242.xaml
new file mode 100644
index 000000000000..440306705261
--- /dev/null
+++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18242.xaml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18242.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18242.xaml.cs
new file mode 100644
index 000000000000..fd30607ce328
--- /dev/null
+++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue18242.xaml.cs
@@ -0,0 +1,15 @@
+using Microsoft.Maui.Controls;
+using Microsoft.Maui.Controls.Xaml;
+
+namespace Maui.Controls.Sample.Issues
+{
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ [Issue(IssueTracker.Github, 18242, "Button ImageSource not Scaling as expected", PlatformAffected.UWP)]
+ public partial class Issue18242 : ContentPage
+ {
+ public Issue18242()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue18242.cs b/src/Controls/tests/UITests/Tests/Issues/Issue18242.cs
new file mode 100644
index 000000000000..5de659beef82
--- /dev/null
+++ b/src/Controls/tests/UITests/Tests/Issues/Issue18242.cs
@@ -0,0 +1,25 @@
+using NUnit.Framework;
+using UITest.Appium;
+using UITest.Core;
+
+namespace Microsoft.Maui.AppiumTests.Issues
+{
+ public class Issue18242 : _IssuesUITest
+ {
+ public Issue18242(TestDevice device) : base(device)
+ {
+ }
+
+ public override string Issue => "Button ImageSource not Scaling as expected";
+
+ [Test]
+ public void Issue18242Test()
+ {
+ this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.iOS }, "Only Windows for now");
+
+ App.WaitForElement("WaitForStubControl");
+
+ VerifyScreenshot();
+ }
+ }
+}
diff --git a/src/Controls/tests/UITests/snapshots/windows/Issue18242Test.png b/src/Controls/tests/UITests/snapshots/windows/Issue18242Test.png
new file mode 100644
index 000000000000..ea9a862f4bdf
Binary files /dev/null and b/src/Controls/tests/UITests/snapshots/windows/Issue18242Test.png differ
diff --git a/src/Core/src/Platform/Windows/ButtonExtensions.cs b/src/Core/src/Platform/Windows/ButtonExtensions.cs
index 46e6fb83f747..21c23f255ab8 100644
--- a/src/Core/src/Platform/Windows/ButtonExtensions.cs
+++ b/src/Core/src/Platform/Windows/ButtonExtensions.cs
@@ -159,11 +159,9 @@ public static void UpdateImageSource(this Button platformButton, WImageSource? n
{
if (platformButton.GetContent() is WImage nativeImage)
{
- nativeImage.Source = nativeImageSource;
-
// Stretch to the size of the button
- nativeImage.HorizontalAlignment = UI.Xaml.HorizontalAlignment.Stretch;
- nativeImage.VerticalAlignment = UI.Xaml.VerticalAlignment.Stretch;
+ nativeImage.Stretch = UI.Xaml.Media.Stretch.Uniform;
+ nativeImage.Source = nativeImageSource;
nativeImage.Visibility = nativeImageSource == null
? UI.Xaml.Visibility.Collapsed