UIElementColor() public method

public UIElementColor ( [ desiredElement ) : Color
desiredElement [
return Color
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // Apply correct coloring when in High Contrast

            ViewManagement.AccessibilitySettings accessibilitySettings = new ViewManagement.AccessibilitySettings();
            if (!(accessibilitySettings.HighContrast) /*Off*/)
            {
                // Use default colors

                this.Background = new SolidColorBrush(Colors.Red);
                this.BorderBrush = new SolidColorBrush(Colors.Black);

                this.Circle4.Fill = new SolidColorBrush(Colors.Blue);
                this.Circle3.Fill = new SolidColorBrush(Colors.Green);
                this.Circle2.Fill = new SolidColorBrush(Colors.Yellow);
                this.Circle1.Fill = new SolidColorBrush(Colors.White);
                this.Circle4.Stroke = this.Circle3.Stroke = this.Circle2.Stroke = this.Circle1.Stroke = new SolidColorBrush(Colors.Black);
            }
            else
            {
                // Use High Contrast Colors

                ViewManagement.UISettings uiSettings = new ViewManagement.UISettings();

                switch (accessibilitySettings.HighContrastScheme)
                {
                    case "High Contrast Black":
                        this.Background = this.Circle4.Fill = this.Circle3.Fill = this.Circle2.Fill = this.Circle1.Fill = new SolidColorBrush(Colors.Black);
                        this.BorderBrush = this.Circle4.Stroke = this.Circle3.Stroke = this.Circle2.Stroke = this.Circle1.Stroke = new SolidColorBrush(Colors.White);
                        break;

                    case "High Contrast White":
                        this.Background = this.Circle4.Fill = this.Circle3.Fill = this.Circle2.Fill = this.Circle1.Fill = new SolidColorBrush(Colors.White);
                        this.BorderBrush = this.Circle4.Stroke = this.Circle3.Stroke = this.Circle2.Stroke = this.Circle1.Stroke = new SolidColorBrush(Colors.Black);
                        break;

                    default: // For all other High Contrast schemes
                        this.Background = new SolidColorBrush(uiSettings.UIElementColor(ViewManagement.UIElementType.ButtonFace));
                        this.BorderBrush = new SolidColorBrush(uiSettings.UIElementColor(ViewManagement.UIElementType.ButtonText));
                        this.Circle4.Fill = this.Circle3.Fill = this.Circle2.Fill = this.Circle1.Fill = new SolidColorBrush(uiSettings.UIElementColor(ViewManagement.UIElementType.Hotlight));
                        this.Circle4.Stroke = this.Circle3.Stroke = this.Circle2.Stroke = this.Circle1.Stroke = new SolidColorBrush(uiSettings.UIElementColor(ViewManagement.UIElementType.HighlightText));
                        break;
                }


            }
        }
Exemplo n.º 2
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // Apply correct coloring when in High Contrast

            ViewManagement.AccessibilitySettings accessibilitySettings = new ViewManagement.AccessibilitySettings();
            if (!(accessibilitySettings.HighContrast) /*Off*/)
            {
                // Use default colors

                this.Background  = new SolidColorBrush(Colors.Red);
                this.BorderBrush = new SolidColorBrush(Colors.Black);

                this.Circle4.Fill   = new SolidColorBrush(Colors.Blue);
                this.Circle3.Fill   = new SolidColorBrush(Colors.Green);
                this.Circle2.Fill   = new SolidColorBrush(Colors.Yellow);
                this.Circle1.Fill   = new SolidColorBrush(Colors.White);
                this.Circle4.Stroke = this.Circle3.Stroke = this.Circle2.Stroke = this.Circle1.Stroke = new SolidColorBrush(Colors.Black);
            }
            else
            {
                // Use High Contrast Colors

                ViewManagement.UISettings uiSettings = new ViewManagement.UISettings();

                switch (accessibilitySettings.HighContrastScheme)
                {
                case "High Contrast Black":
                    this.Background  = this.Circle4.Fill = this.Circle3.Fill = this.Circle2.Fill = this.Circle1.Fill = new SolidColorBrush(Colors.Black);
                    this.BorderBrush = this.Circle4.Stroke = this.Circle3.Stroke = this.Circle2.Stroke = this.Circle1.Stroke = new SolidColorBrush(Colors.White);
                    break;

                case "High Contrast White":
                    this.Background  = this.Circle4.Fill = this.Circle3.Fill = this.Circle2.Fill = this.Circle1.Fill = new SolidColorBrush(Colors.White);
                    this.BorderBrush = this.Circle4.Stroke = this.Circle3.Stroke = this.Circle2.Stroke = this.Circle1.Stroke = new SolidColorBrush(Colors.Black);
                    break;

                default:     // For all other High Contrast schemes
                    this.Background     = new SolidColorBrush(uiSettings.UIElementColor(ViewManagement.UIElementType.ButtonFace));
                    this.BorderBrush    = new SolidColorBrush(uiSettings.UIElementColor(ViewManagement.UIElementType.ButtonText));
                    this.Circle4.Fill   = this.Circle3.Fill = this.Circle2.Fill = this.Circle1.Fill = new SolidColorBrush(uiSettings.UIElementColor(ViewManagement.UIElementType.Hotlight));
                    this.Circle4.Stroke = this.Circle3.Stroke = this.Circle2.Stroke = this.Circle1.Stroke = new SolidColorBrush(uiSettings.UIElementColor(ViewManagement.UIElementType.HighlightText));
                    break;
                }
            }
        }
Exemplo n.º 3
0
        // Plots a graph of the passed easing function using the given sampling interval on the "Graph" Canvas control 
        private void PlotEasingFunctionGraph(EasingFunctionBase easingFunction, double samplingInterval)
        {
            UISettings UserSettings = new UISettings();
            Graph.Children.Clear();

            Path path = new Path();
            PathGeometry pathGeometry = new PathGeometry();
            PathFigure pathFigure = new PathFigure() { StartPoint = new Point(0, 0) };
            PathSegmentCollection pathSegmentCollection = new PathSegmentCollection();

            // Note that an easing function is just like a regular function that operates on doubles.
            // Here we plot the range of the easing function's output on the y-axis of a graph.
            for (double i = 0; i < 1; i += samplingInterval)
            {
                double x = i * GraphContainer.Width;
                double y = easingFunction.Ease(i) * GraphContainer.Height;

                LineSegment segment = new LineSegment();
                segment.Point = new Point(x, y);
                pathSegmentCollection.Add(segment);
            }

            pathFigure.Segments = pathSegmentCollection;
            pathGeometry.Figures.Add(pathFigure);
            path.Data = pathGeometry;
            path.Stroke = new SolidColorBrush(UserSettings.UIElementColor(UIElementType.ButtonText));
            path.StrokeThickness = 1;

            // Add the path to the Canvas
            Graph.Children.Add(path);
        }