コード例 #1
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();
        }
コード例 #2
0
        }//Button Down method ends here

        private void ButtonUp(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("Button Up");

            Button      myButton    = sender as Button;
            Brush       buttonDark  = myButton.Background;
            Colorpicker colorPicker = new Colorpicker(buttonDark);

            myButton.Background = colorPicker.lighter();
        }//ButtonUp method ends here
コード例 #3
0
        private void CheckBoxMouseUp(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;

            Console.WriteLine("Mouse Up CheckBox");

            Colorpicker colorPicker = new Colorpicker(checkBox.Background);

            checkBox.Background = colorPicker.lighter();
        }
コード例 #4
0
        private void MenuMouseEnter(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("MouseEnter");
            MenuItem    menuItem      = sender as MenuItem;
            Brush       menuItemColor = menuItem.Background;
            Colorpicker colorPicker   = new Colorpicker(menuItemColor);

            menuItem.Background = colorPicker.dark();
            Console.WriteLine(menuItem.Background);
        }
コード例 #5
0
        }//loaded event of border end here

        private void TabItemLoaded(object sender, RoutedEventArgs e)
        {
            Colorpicker colorPicker;
            TabItem     tabItem = sender as TabItem;

            if (tabItem.IsSelected)
            {
                colorPicker        = new Colorpicker(tabItem.Background);
                tabItem.Background = colorPicker.darker();
            }
        }//loaded event of tabitem end here
コード例 #6
0
        private void TabRadioButtonMouseLeave(object sender, RoutedEventArgs e)
        {
            RadioButton button = sender as RadioButton;

            Console.WriteLine("TabRadioButton Mouse Enter ");
            BulletDecorator bullet      = VisualTreeHelper.GetChild(button, 0) as BulletDecorator;
            Border          border      = VisualTreeHelper.GetChild(bullet, 0) as Border;
            Colorpicker     colorPicker = new Colorpicker(border.Background);

            border.Background = colorPicker.light();
        }
コード例 #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();
            }
        }
コード例 #8
0
        //------------------------------------------------BUTTONGROUP REGION START---------------------------------------------------------------------------------

        private void ButtonGroupLoaded(object sender, RoutedEventArgs e)
        {
            //Creating the borderbrush..
            Border border = sender as Border;
            //Getting the darker color of the background..
            Colorpicker colorPicker = new Colorpicker(border.Background);

            RadioButton button = VisualTreeHelper.GetParent(border) as RadioButton;

            if (button.IsChecked == true)
            {
                border.BorderBrush = colorPicker.light();
            }
            else
            {
                border.BorderBrush = colorPicker.dark();
            }
        }
コード例 #9
0
        private void ButtonGroupMouseUp(object sender, RoutedEventArgs e)
        {
            //Creating the borderbrush..
            RadioButton border      = sender as RadioButton;
            ButtonGroup buttonGroup = VisualTreeHelper.GetParent(border) as ButtonGroup;

            for (int i = 0; i < buttonGroup.Children.Count; i++)
            {
                RadioButton child = VisualTreeHelper.GetChild(buttonGroup, i) as RadioButton;
                if (child.IsChecked == true)
                {
                    child.IsChecked = false;
                    Colorpicker colorPicker = new Colorpicker(child.Background);
                    child.Background = colorPicker.lighter();
                }
            }

            border.IsChecked = true;
        }
コード例 #10
0
        private void mouse_leftdown(object sender, RoutedEventArgs e)
        {
            Colorpicker colorPicker;
            TabItem     myTabitem = sender as TabItem;// myBorder is a Instance of Border

            if (myTabitem.IsSelected == false)
            {
                TabPanel tabPanel = VisualTreeHelper.GetParent(myTabitem) as TabPanel;
                //Console.WriteLine( tabPanel.Children.Count );
                for (int i = 0; i < tabPanel.Children.Count; i++)
                {
                    TabItem tabItem = tabPanel.Children[i] as TabItem;
                    if (tabItem.IsSelected == true)
                    {
                        colorPicker          = new Colorpicker(tabItem.Background);
                        tabItem.Background   = colorPicker.lighter();
                        myTabitem.IsSelected = false;
                    }
                }
                colorPicker          = new Colorpicker(myTabitem.Background);
                myTabitem.Background = colorPicker.darker();
                myTabitem.IsSelected = true;
            }
        }//mouse left down button for tabcontrol end here
コード例 #11
0
        private void RadioButtonUp(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("In button up property");
            //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.lighter();
            }
            else
            {
                radioButton = radioButtonDisable;
                Colorpicker colorPicker = new Colorpicker(radioButton.Background);
                radioButton.Background = colorPicker.lighter();
            }
            Console.WriteLine("PrevCheck value is " + stackPanel.PrevCheck);
            if (stackPanel.PrevCheck)
            {
                if (EnabledFlag)
                {
                    Console.WriteLine("I am inside enabled flag background");
                    Colorpicker colorPicker = new Colorpicker(radioButtonDisable.Background);
                    radioButtonEnable.Background  = colorPicker.dark();
                    radioButtonDisable.Background = new SolidColorBrush(Color.FromRgb(219, 219, 224));
                    stackPanel.PrevCheck          = false;
                }
            }

            if (stackPanel.PrevCheck == false)
            {
                if (EnabledFlag == false)
                {
                    Console.WriteLine("I am inside disabled flag background");
                    Colorpicker colorPicker = new Colorpicker(radioButtonEnable.Background);
                    radioButtonDisable.Background = colorPicker.dark();
                    radioButtonEnable.Background  = new SolidColorBrush(Color.FromRgb(219, 219, 224));
                    stackPanel.PrevCheck          = true;
                }
            }
        }