Ejemplo n.º 1
0
        private void ButtonGroupLoaded(object sender, RoutedEventArgs e)
        {
            int children = this.Children.Count;

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadioButton myRadioButton = this.Children[i] as RadioButton;

                //Removing margin of all radiobutton..
                myRadioButton.Margin = new Thickness(0);

                //Finding the border of the element..
                Border border = VisualTreeHelper.GetChild(this.Children[i], 0) as Border;

                //Checking for first radiobutton..
                if (i == 0)
                {
                    border.CornerRadius = new CornerRadius(10, 0, 0, 10);
                }

                //Now checking for last radiobutton.
                if (i == children - 1)
                {
                    border.CornerRadius = new CornerRadius(0, 10, 10, 0);
                    //Removing the thickness for last radioButton..
                    border.BorderThickness = new  Thickness(0);
                }
                //Checking for IsChecked property..
                if (myRadioButton.IsChecked == true)
                {
                    Colorpicker colorPicker = new Colorpicker(myRadioButton.Background);
                    myRadioButton.Background = colorPicker.darker();
                }
            }
        }
Ejemplo n.º 2
0
        //Now defining class for menu..
        private void MenuMouseDown(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("MouseLeftDown");
            MenuItem    menuItem      = sender as MenuItem;
            Brush       menuItemColor = menuItem.Background;
            Colorpicker colorPicker   = new Colorpicker(menuItemColor);

            menuItem.Background = colorPicker.darker();
        }
Ejemplo n.º 3
0
        private void CheckBoxMouseDown(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;

            Console.WriteLine("Mouse Down CheckBox");
            Colorpicker colorPicker = new Colorpicker(checkBox.Background);

            checkBox.Background = colorPicker.darker();
        }
Ejemplo n.º 4
0
        private void ButtonDown(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("ButtonDown");
            Button      myButton    = sender as Button;
            Brush       buttonDark  = myButton.Background;
            Colorpicker colorPicker = new Colorpicker(buttonDark);

            myButton.Background = colorPicker.darker();
        }//Button Down method ends here
Ejemplo n.º 5
0
        private void ItemMouseDown(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("MenuItem MouseDown");
            Rectangle   rect        = sender as Rectangle;
            Brush       itemColor   = rect.Fill;
            Colorpicker colorPicker = new Colorpicker(itemColor);

            rect.Fill = colorPicker.darker();
        }
Ejemplo n.º 6
0
        private void ButtonGroupMouseDown(object sender, RoutedEventArgs e)
        {
            //Creating the borderbrush..
            RadioButton border = sender as RadioButton;

            //Getting the darker color of the background..
            Colorpicker colorPicker = new Colorpicker(border.Background);

            border.Background = colorPicker.darker();
        }
Ejemplo n.º 7
0
        //-------------------------------------------------------------------------EVENT FOR RADIOBUTTON---------------------------------------------------------------------------
        private void RadioButtonDown(object sender, RoutedEventArgs e)
        {
            //Checking the IsChecked property....
            CustomPanel stackPanel         = sender as CustomPanel;
            Border      radioButtonEnable  = stackPanel.FindName("EnableButton") as Border;
            Border      radioButtonDisable = stackPanel.FindName("DisableButton") as Border;
            Border      radioButton;
            Boolean     EnabledFlag = true;

            try
            {
                ContentPresenter myContent = e.Source as ContentPresenter;
                Console.WriteLine(myContent.Content);
                if ((String)myContent.Tag == "Disable")
                {
                    EnabledFlag = false;
                }
                else
                {
                    EnabledFlag = true;
                }
            }
            catch (Exception)
            {
                Border myBorder = e.Source as Border;
                if ((String)myBorder.Tag == "Disable")
                {
                    EnabledFlag = false;
                }
                else
                {
                    EnabledFlag = true;
                }
            }
            if (EnabledFlag)
            {
                radioButton = radioButtonEnable;
                Colorpicker colorPicker = new Colorpicker(radioButton.Background);
                radioButton.Background = colorPicker.darker();
            }
            else
            {
                radioButton = radioButtonDisable;
                Colorpicker colorPicker = new Colorpicker(radioButton.Background);
                radioButton.Background = colorPicker.darker();
            }
        }