diff --git a/src/GraphicsControls.Sample/GraphicsControls.Sample/GalleryPageCSharp.cs b/src/GraphicsControls.Sample/GraphicsControls.Sample/GalleryPageCSharp.cs
index 0e35594..ba0bca6 100644
--- a/src/GraphicsControls.Sample/GraphicsControls.Sample/GalleryPageCSharp.cs
+++ b/src/GraphicsControls.Sample/GraphicsControls.Sample/GalleryPageCSharp.cs
@@ -107,7 +107,7 @@ namespace GraphicsControls.Sample
layout.Children.Add(new CheckBox { IsEnabled = false, IsChecked = true });
layout.Children.Add(new Label { FontSize = 9, TextColor = Colors.Gray, Text = "Custom" });
- layout.Children.Add(new CheckBox { BackgroundColor = Colors.Purple, IsChecked = true });
+ layout.Children.Add(new CheckBox { Color = Colors.Purple, IsChecked = true });
return CreateContainer("CheckBox", layout);
}
diff --git a/src/GraphicsControls.Sample/GraphicsControls.Sample/GalleryPageXAML.xaml b/src/GraphicsControls.Sample/GraphicsControls.Sample/GalleryPageXAML.xaml
index ca4badc..bb540e6 100644
--- a/src/GraphicsControls.Sample/GraphicsControls.Sample/GalleryPageXAML.xaml
+++ b/src/GraphicsControls.Sample/GraphicsControls.Sample/GalleryPageXAML.xaml
@@ -73,7 +73,7 @@
-
+
diff --git a/src/GraphicsControls/Handlers/CheckBox/CheckBoxHandler.cs b/src/GraphicsControls/Handlers/CheckBox/CheckBoxHandler.cs
index 5318992..5182243 100644
--- a/src/GraphicsControls/Handlers/CheckBox/CheckBoxHandler.cs
+++ b/src/GraphicsControls/Handlers/CheckBox/CheckBoxHandler.cs
@@ -18,7 +18,8 @@ namespace Microsoft.Maui.Graphics.Controls
public static PropertyMapper PropertyMapper = new PropertyMapper(ViewHandler.Mapper)
{
- [nameof(ICheckBox.IsChecked)] = ViewHandler.MapInvalidate
+ [nameof(ICheckBox.IsChecked)] = ViewHandler.MapInvalidate,
+ [nameof(ICheckBox.Foreground)] = ViewHandler.MapInvalidate,
};
public static DrawMapper DrawMapper = new DrawMapper(ViewHandler.DrawMapper)
diff --git a/src/GraphicsControls/Handlers/CheckBox/CupertinoCheckBoxDrawable.cs b/src/GraphicsControls/Handlers/CheckBox/CupertinoCheckBoxDrawable.cs
index c3a587f..49a2ec7 100644
--- a/src/GraphicsControls/Handlers/CheckBox/CupertinoCheckBoxDrawable.cs
+++ b/src/GraphicsControls/Handlers/CheckBox/CupertinoCheckBoxDrawable.cs
@@ -15,7 +15,12 @@
if (checkBox.IsChecked)
{
- canvas.FillColor = checkBox.IsEnabled ? Cupertino.Color.SystemColor.Light.Blue.ToColor() : Cupertino.Color.SystemGray.Light.InactiveGray.ToColor();
+ Color fillColor = checkBox.IsEnabled ? Cupertino.Color.SystemColor.Light.Blue.ToColor() : Cupertino.Color.SystemGray.Light.InactiveGray.ToColor();
+
+ if (checkBox.Foreground is SolidPaint solidPaint)
+ fillColor = solidPaint.Color;
+
+ canvas.FillColor = fillColor;
canvas.FillEllipse(x, y, size, size);
}
else
diff --git a/src/GraphicsControls/Handlers/CheckBox/FluentCheckBoxDrawable.cs b/src/GraphicsControls/Handlers/CheckBox/FluentCheckBoxDrawable.cs
index aedc12e..cc16014 100644
--- a/src/GraphicsControls/Handlers/CheckBox/FluentCheckBoxDrawable.cs
+++ b/src/GraphicsControls/Handlers/CheckBox/FluentCheckBoxDrawable.cs
@@ -16,7 +16,14 @@
if (checkBox.IsChecked)
{
if (checkBox.IsEnabled)
- canvas.FillColor = Fluent.Color.Primary.ThemePrimary.ToColor();
+ {
+ Color fillColor = Fluent.Color.Primary.ThemePrimary.ToColor();
+
+ if (checkBox.Foreground is SolidPaint solidPaint)
+ fillColor = solidPaint.Color;
+
+ canvas.FillColor = fillColor;
+ }
else
canvas.FillColor = Fluent.Color.Background.NeutralQuaternaryAlt.ToColor();
diff --git a/src/GraphicsControls/Handlers/CheckBox/MaterialCheckBoxDrawable.cs b/src/GraphicsControls/Handlers/CheckBox/MaterialCheckBoxDrawable.cs
index c4b0971..05fcf5d 100644
--- a/src/GraphicsControls/Handlers/CheckBox/MaterialCheckBoxDrawable.cs
+++ b/src/GraphicsControls/Handlers/CheckBox/MaterialCheckBoxDrawable.cs
@@ -18,7 +18,14 @@ namespace Microsoft.Maui.Graphics.Controls
if (checkBox.IsChecked)
{
if (checkBox.IsEnabled)
- canvas.FillColor = Material.Color.Blue.ToColor();
+ {
+ Color fillColor = Material.Color.Blue.ToColor();
+
+ if (checkBox.Foreground is SolidPaint solidPaint)
+ fillColor = solidPaint.Color;
+
+ canvas.FillColor = fillColor;
+ }
else
{
if (Application.Current?.RequestedTheme == OSAppTheme.Light)