当前位置: 首页>>代码示例>>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;未经允许,请勿转载。