當前位置: 首頁>>代碼示例>>C#>>正文


C# Color.?.Darken方法代碼示例

本文整理匯總了C#中Color.?.Darken方法的典型用法代碼示例。如果您正苦於以下問題:C# Color.?.Darken方法的具體用法?C# Color.?.Darken怎麽用?C# Color.?.Darken使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Color的用法示例。


在下文中一共展示了Color.?.Darken方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RefreshStyles

        public void RefreshStyles(Color? color = null)
        {
            DebugWrite($"Color: {color}");

            if (color != null)
            {
                // since every brush will be based on one color,
                // we will do so with theme in mind.

                switch (RequestedTheme)
                {
                    case ElementTheme.Default:
                    case ElementTheme.Light:
                        {
                            HamburgerBackground = color?.ToSolidColorBrush();
                            HamburgerForeground = Colors.White.ToSolidColorBrush();
                            NavAreaBackground = Colors.DimGray.ToSolidColorBrush();
                            NavButtonBackground = Colors.Transparent.ToSolidColorBrush();
                            NavButtonForeground = Colors.White.ToSolidColorBrush();
                            NavButtonCheckedForeground = Colors.White.ToSolidColorBrush();
                            NavButtonCheckedBackground = color?.Lighten(ColorUtils.Accents.Plus20).ToSolidColorBrush();
                            NavButtonPressedBackground = Colors.Gainsboro.Darken(ColorUtils.Accents.Plus40).ToSolidColorBrush();
                            NavButtonHoverBackground = Colors.Gainsboro.Darken(ColorUtils.Accents.Plus60).ToSolidColorBrush();
                            SecondarySeparator = PaneBorderBrush = Colors.Gainsboro.Darken(ColorUtils.Accents.Plus40).ToSolidColorBrush();
                        }
                        break;
                    case ElementTheme.Dark:
                        {
                            HamburgerBackground = color?.ToSolidColorBrush();
                            HamburgerForeground = Colors.White.ToSolidColorBrush();
                            NavAreaBackground = Colors.Gainsboro.Darken(ColorUtils.Accents.Plus80).ToSolidColorBrush();
                            NavButtonBackground = Colors.Transparent.ToSolidColorBrush();
                            NavButtonForeground = Colors.White.ToSolidColorBrush();
                            NavButtonCheckedForeground = Colors.White.ToSolidColorBrush();
                            NavButtonCheckedBackground = color?.Darken(ColorUtils.Accents.Plus40).ToSolidColorBrush();
                            NavButtonPressedBackground = Colors.Gainsboro.Lighten(ColorUtils.Accents.Plus40).ToSolidColorBrush();
                            NavButtonHoverBackground = Colors.Gainsboro.Lighten(ColorUtils.Accents.Plus60).ToSolidColorBrush();
                            SecondarySeparator = PaneBorderBrush = Colors.Gainsboro.ToSolidColorBrush();
                        }
                        break;
                }
            }
        }
開發者ID:bc3tech,項目名稱:Template10,代碼行數:43,代碼來源:HamburgerMenu.xaml.cs

示例2: RefreshStyles

        public void RefreshStyles(Color? color = null)
        {
            if (color == null)
            {
                // manually setting the brushes is a way of ignoring the themes
                // in this block we will unset, then re-set the values

                var hamburgerBackground = HamburgerBackground;
                var hamburgerForeground = HamburgerForeground;
                var navAreaBackground = NavAreaBackground;
                var navButtonBackground = NavButtonBackground;
                var navButtonForeground = NavButtonForeground;
                var navButtonCheckedBackground = NavButtonCheckedBackground;
                var navButtonPressedBackground = NavButtonPressedBackground;
                var navButtonHoverBackground = NavButtonHoverBackground;
                var navButtonCheckedForeground = NavButtonCheckedForeground;
                var secondarySeparator = SecondarySeparator;

                HamburgerBackground = null;
                HamburgerForeground = null;
                NavAreaBackground = null;
                NavButtonBackground = null;
                NavButtonForeground = null;
                NavButtonCheckedBackground = null;
                NavButtonPressedBackground = null;
                NavButtonHoverBackground = null;
                NavButtonCheckedForeground = null;
                SecondarySeparator = null;

                HamburgerBackground = hamburgerBackground;
                HamburgerForeground = hamburgerForeground;
                NavAreaBackground = navAreaBackground;
                NavButtonBackground = navButtonBackground;
                NavButtonForeground = navButtonForeground;
                NavButtonCheckedBackground = navButtonCheckedBackground;
                NavButtonPressedBackground = navButtonPressedBackground;
                NavButtonHoverBackground = navButtonHoverBackground;
                NavButtonCheckedForeground = navButtonCheckedForeground;
                SecondarySeparator = secondarySeparator;
            }
            else
            {
                // since every brush will be based on one color,
                // we will do so with theme in mind.

                switch (RequestedTheme)
                {
                    case ElementTheme.Light:
                        HamburgerBackground = color?.ToSolidColorBrush();
                        HamburgerForeground = Colors.White.ToSolidColorBrush();
                        NavAreaBackground = Colors.DimGray.ToSolidColorBrush();
                        NavButtonBackground = Colors.Transparent.ToSolidColorBrush();
                        NavButtonForeground = Colors.White.ToSolidColorBrush();
                        NavButtonCheckedForeground = Colors.White.ToSolidColorBrush();
                        NavButtonCheckedBackground = color?.Lighten(ColorUtils.Accents.Plus20).ToSolidColorBrush();
                        NavButtonPressedBackground = Colors.Gainsboro.Darken(ColorUtils.Accents.Plus40).ToSolidColorBrush();
                        NavButtonHoverBackground = Colors.Gainsboro.Darken(ColorUtils.Accents.Plus60).ToSolidColorBrush();
                        NavButtonCheckedForeground = Colors.White.ToSolidColorBrush();
                        SecondarySeparator = Colors.Gainsboro.Darken(ColorUtils.Accents.Plus40).ToSolidColorBrush();
                        break;
                    case ElementTheme.Default:
                    case ElementTheme.Dark:
                        HamburgerBackground = color?.ToSolidColorBrush();
                        HamburgerForeground = Colors.White.ToSolidColorBrush();
                        NavAreaBackground = Colors.Gainsboro.Darken(ColorUtils.Accents.Plus80).ToSolidColorBrush();
                        NavButtonBackground = Colors.Transparent.ToSolidColorBrush();
                        NavButtonForeground = Colors.White.ToSolidColorBrush();
                        NavButtonCheckedForeground = Colors.White.ToSolidColorBrush();
                        NavButtonCheckedBackground = color?.Darken(ColorUtils.Accents.Plus40).ToSolidColorBrush();
                        NavButtonPressedBackground = Colors.Gainsboro.Lighten(ColorUtils.Accents.Plus40).ToSolidColorBrush();
                        NavButtonHoverBackground = Colors.Gainsboro.Lighten(ColorUtils.Accents.Plus60).ToSolidColorBrush();
                        NavButtonCheckedForeground = Colors.White.ToSolidColorBrush();
                        SecondarySeparator = Colors.Gainsboro.ToSolidColorBrush();
                        break;
                }
            }
        }
開發者ID:shyamalschandra,項目名稱:Template10,代碼行數:77,代碼來源:HamburgerMenu.xaml.cs


注:本文中的Color.?.Darken方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。