Ejemplo n.º 1
0
        public SelectColor()
        {
            Title         = "Select Color";
            SizeToContent = SizeToContent.WidthAndHeight;

            // Creation StackPanel obj as window content
            StackPanel stack = new StackPanel();

            stack.Orientation = Orientation.Horizontal;
            Content           = stack;

            // Creation facke button for checking focus
            Button btn = new Button();

            btn.Content             = "Do-nothing button\nto test tabbing";
            btn.Margin              = new Thickness(24);
            btn.HorizontalAlignment = HorizontalAlignment.Center;
            btn.VerticalAlignment   = VerticalAlignment.Center;
            stack.Children.Add(btn);

            // Creation ColorGrid obj
            ColorGrid clrgrid = new ColorGrid();

            clrgrid.Margin = new Thickness(24);
            clrgrid.HorizontalAlignment   = HorizontalAlignment.Center;
            clrgrid.VerticalAlignment     = VerticalAlignment.Center;
            clrgrid.SelectedColorChanged += ColorGridOnSelectedColorChanged;
            stack.Children.Add(clrgrid);

            // Creation another facke button
            btn                     = new Button();
            btn.Content             = "Do-nothing button\nto test tabbing";
            btn.Margin              = new Thickness(24);
            btn.HorizontalAlignment = HorizontalAlignment.Center;
            btn.VerticalAlignment   = VerticalAlignment.Center;
            stack.Children.Add(btn);
        }
Ejemplo n.º 2
0
        private void ColorGridOnSelectedColorChanged(object sender, EventArgs args)
        {
            ColorGrid clrgrid = sender as ColorGrid;

            Background = new SolidColorBrush(clrgrid.SelectedColor);
        }