/// <summary>
        /// Occurs when the <see cref="RoutedCommand"/> is executed.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">An <see cref="ExecutedRoutedEventArgs"/> that contains the event data.</param>
        private void OnApplyForegroundExecute(object sender, ExecutedRoutedEventArgs e)
        {
            BrushValueCommandParameter parameter = e.Parameter as BrushValueCommandParameter;

            if (parameter != null)
            {
                switch (parameter.Action)
                {
                case ValueCommandParameterAction.CancelPreview:
                    this.DeactivatePreviewMode(true);
                    break;

                case ValueCommandParameterAction.Commit:
                    this.DeactivatePreviewMode(false);
                    this.SelectionForeground = parameter.Value;
                    this.UpdateApplyDefaultForegroundSmallImageSource(parameter.Value);
                    break;

                case ValueCommandParameterAction.Preview:
                    this.ActivatePreviewMode();
                    this.SelectionForeground = parameter.PreviewValue;
                    break;
                }
            }
            else
            {
                this.SelectionForeground = null;
                this.UpdateApplyDefaultForegroundSmallImageSource(null);
            }
            e.Handled = true;
        }
        /// <summary>
        /// Occurs when the <see cref="RoutedCommand"/> needs to determine whether it can execute.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">A <see cref="CanExecuteRoutedEventArgs"/> that contains the event data.</param>
        private void OnApplyForegroundCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            BrushValueCommandParameter parameter = e.Parameter as BrushValueCommandParameter;

            if ((parameter != null) && (!this.IsPreviewModeActive))
            {
                parameter.UpdatedValue = this.SelectionForeground;
                parameter.Handled      = true;
            }
            e.CanExecute = true;
        }