ChildEducationSoftwareGUI.MainWindow.cboColor_SelectionChanged C# (CSharp) Method

cboColor_SelectionChanged() private method

private cboColor_SelectionChanged ( object sender, System.Windows.Controls.SelectionChangedEventArgs e ) : void
sender object
e System.Windows.Controls.SelectionChangedEventArgs
return void
        private void cboColor_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cboColor.Items.Count > 0 && ((ComboBoxItem)cboColor.SelectedItem).Content != null)
            {
                if (((ComboBoxItem)cboColor.SelectedItem).Content.ToString() == "Blue")
                    drawingPane.DefaultDrawingAttributes.Color = Colors.Blue;
                else if (((ComboBoxItem)cboColor.SelectedItem).Content.ToString() == "Green")
                    drawingPane.DefaultDrawingAttributes.Color = Colors.Green;
                else if (((ComboBoxItem)cboColor.SelectedItem).Content.ToString() == "Red")
                    drawingPane.DefaultDrawingAttributes.Color = Colors.Red;
                else if (((ComboBoxItem)cboColor.SelectedItem).Content.ToString() == "Yellow")
                    drawingPane.DefaultDrawingAttributes.Color = Colors.Yellow;
                else if (((ComboBoxItem)cboColor.SelectedItem).Content.ToString() == "Black")
                    drawingPane.DefaultDrawingAttributes.Color = Colors.Black;
            }
        }