public static void UpdateTextColor(this TimePicker platformTimePicker, ITimePicker timePicker) { Color textColor = timePicker.TextColor; UI.Xaml.Media.Brush?brush = textColor?.ToPlatform(); if (brush is null) { platformTimePicker.Resources.Remove("TimePickerButtonForeground"); platformTimePicker.Resources.Remove("TimePickerButtonForegroundPointerOver"); platformTimePicker.Resources.Remove("TimePickerButtonForegroundPressed"); platformTimePicker.Resources.Remove("TimePickerButtonForegroundDisabled"); platformTimePicker.ClearValue(TimePicker.ForegroundProperty); } else { platformTimePicker.Resources["TimePickerButtonForeground"] = brush; platformTimePicker.Resources["TimePickerButtonForegroundPointerOver"] = brush; platformTimePicker.Resources["TimePickerButtonForegroundPressed"] = brush; platformTimePicker.Resources["TimePickerButtonForegroundDisabled"] = brush; platformTimePicker.Foreground = brush; } }
protected override void SetupDefaults(Button nativeView) { DefaultPadding = (UI.Xaml.Thickness)MauiWinUIApplication.Current.Resources["ButtonPadding"]; DefaultForeground = (UI.Xaml.Media.Brush)MauiWinUIApplication.Current.Resources["ButtonForegroundThemeBrush"]; DefaultBackground = (UI.Xaml.Media.Brush)MauiWinUIApplication.Current.Resources["ButtonBackgroundThemeBrush"]; base.SetupDefaults(nativeView); }
public static void UpdateBackground(this Button nativeButton, IButton button, UI.Xaml.Media.Brush?defaultBrush = null) => nativeButton.UpdateBackground(button.Background, defaultBrush);
public static void UpdateTextColor(this Button nativeButton, IButton button, UI.Xaml.Media.Brush?defaultBrush = null) => nativeButton.UpdateForegroundColor(button.TextColor, defaultBrush);
public static void UpdateForegroundColor(this Control nativeControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) => nativeControl.Foreground = color.IsDefault && defaultBrush != null ? defaultBrush : color.ToNative();
public static void UpdateForegroundColor(this Control nativeControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) => nativeControl.Foreground = color?.ToNative() ?? defaultBrush ?? nativeControl.Foreground;
public static void UpdateBackground(this Panel nativeControl, Paint?paint, UI.Xaml.Media.Brush?defaultBrush = null) => nativeControl.UpdateProperty(Panel.BackgroundProperty, paint.IsNullOrEmpty() ? defaultBrush : paint?.ToNative());
public static void UpdateBackground(this Control nativeControl, IView view, UI.Xaml.Media.Brush?defaultBrush = null) => nativeControl.UpdateBackground(view.Background, defaultBrush);
public static void UpdateBackgroundColor(this Border nativeControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) => nativeControl.Background = color?.ToNative() ?? defaultBrush ?? nativeControl.Background;
public static void UpdateForegroundColor(this Control platformControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) => platformControl.Foreground = color?.ToPlatform() ?? defaultBrush ?? platformControl.Foreground;
public static void UpdateBackground(this Border platformControl, Paint?paint, UI.Xaml.Media.Brush?defaultBrush = null) => platformControl.UpdateProperty(Border.BackgroundProperty, paint.IsNullOrEmpty() ? defaultBrush : paint?.ToPlatform());
public static void UpdateBackgroundColor(this Panel nativeControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) => nativeControl.Background = color.IsDefault() && defaultBrush != null ? defaultBrush : color.ToNative();