Пример #1
0
        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;
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
 public static void UpdateBackground(this Button nativeButton, IButton button, UI.Xaml.Media.Brush?defaultBrush = null) =>
 nativeButton.UpdateBackground(button.Background, defaultBrush);
Пример #4
0
 public static void UpdateTextColor(this Button nativeButton, IButton button, UI.Xaml.Media.Brush?defaultBrush = null) =>
 nativeButton.UpdateForegroundColor(button.TextColor, defaultBrush);
Пример #5
0
 public static void UpdateForegroundColor(this Control nativeControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) =>
 nativeControl.Foreground = color.IsDefault && defaultBrush != null ? defaultBrush : color.ToNative();
Пример #6
0
 public static void UpdateForegroundColor(this Control nativeControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) =>
 nativeControl.Foreground = color?.ToNative() ?? defaultBrush ?? nativeControl.Foreground;
Пример #7
0
 public static void UpdateBackground(this Panel nativeControl, Paint?paint, UI.Xaml.Media.Brush?defaultBrush = null) =>
 nativeControl.UpdateProperty(Panel.BackgroundProperty, paint.IsNullOrEmpty() ? defaultBrush : paint?.ToNative());
Пример #8
0
 public static void UpdateBackground(this Control nativeControl, IView view, UI.Xaml.Media.Brush?defaultBrush = null) =>
 nativeControl.UpdateBackground(view.Background, defaultBrush);
Пример #9
0
 public static void UpdateBackgroundColor(this Border nativeControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) =>
 nativeControl.Background = color?.ToNative() ?? defaultBrush ?? nativeControl.Background;
Пример #10
0
 public static void UpdateForegroundColor(this Control platformControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) =>
 platformControl.Foreground = color?.ToPlatform() ?? defaultBrush ?? platformControl.Foreground;
Пример #11
0
 public static void UpdateBackground(this Border platformControl, Paint?paint, UI.Xaml.Media.Brush?defaultBrush = null) =>
 platformControl.UpdateProperty(Border.BackgroundProperty, paint.IsNullOrEmpty() ? defaultBrush : paint?.ToPlatform());
Пример #12
0
 public static void UpdateBackgroundColor(this Panel nativeControl, Color color, UI.Xaml.Media.Brush?defaultBrush = null) =>
 nativeControl.Background = color.IsDefault() && defaultBrush != null ? defaultBrush : color.ToNative();