private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            GradientStopEditorControl control = new GradientStopEditorControl();
            PosDialogWindow           window  = new PosDialogWindow(control, "Gradient Stop Editor", 450, 500);

            if ((PosDialogWindow.ShowPosDialogWindow(this, window) != null) &&
                (control.GradientStop != null))
            {
                gradientStopCollection.Add(control.GradientStop);
                listBoxGradientStopCollection.Items.Add(
                    new FormattedListBoxItem(control.GradientStop, true));
                SetPreviewSwatch();
                buttonSave.IsEnabled = true;
            }
        }
        private void buttonEdit_Click(object sender, RoutedEventArgs e)
        {
            if (listBoxGradientStopCollection.SelectedItem == null)
            {
                return;
            }
            FormattedListBoxItem selectedItem =
                listBoxGradientStopCollection.SelectedItem as FormattedListBoxItem;
            GradientStop gradientStop         = selectedItem.GradientStop;
            GradientStopEditorControl control = new GradientStopEditorControl();
            PosDialogWindow           window  = new PosDialogWindow(control, "Gradient Stop Editor", 450, 500);

            control.GradientStop = gradientStop;
            if (PosDialogWindow.ShowPosDialogWindow(this, window) != null)
            {
                selectedItem.SetGradientStop(control.GradientStop);
                gradientStopCollection[listBoxGradientStopCollection.SelectedIndex] =
                    control.GradientStop;

                // Update UI
                SetPreviewSwatch();
                buttonSave.IsEnabled = true;
            }
        }