Пример #1
0
        void UpdateCancelButtonColor()
        {
            var foregroundBrush = Windows.UI.Xaml.Application.Current.Resources["FormsCancelForegroundBrush"] as SolidColorBrush;
            var backgroundBrush = Windows.UI.Xaml.Application.Current.Resources["FormsCancelBackgroundBrush"] as SolidColorBrush;

            Color cancelColor = Element.CancelButtonColor;

            if (cancelColor.IsDefault)
            {
                backgroundBrush.Color = (Windows.UI.Xaml.Application.Current.Resources["TextBoxButtonBackgroundThemeBrush"] as SolidColorBrush).Color;
                foregroundBrush.Color = (Windows.UI.Xaml.Application.Current.Resources["SystemControlBackgroundChromeBlackMediumBrush"] as SolidColorBrush).Color;
            }
            else
            {
                Windows.UI.Color newColor = cancelColor.ToWindowsColor();
                backgroundBrush.Color = newColor;
                foregroundBrush.Color = newColor.GetIdealForegroundForBackgroundColor();
            }
        }