/// <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 OnToggleUnderlineCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            ICheckableCommandParameter parameter = e.Parameter as ICheckableCommandParameter;

            if (parameter != null)
            {
                parameter.Handled   = true;
                parameter.IsChecked = this.SelectionUnderline;
            }
        }
        /// <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 OnAlignJustifyCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            ICheckableCommandParameter parameter = e.Parameter as ICheckableCommandParameter;

            if (parameter != null)
            {
                parameter.Handled   = true;
                parameter.IsChecked = this.SelectionAlignJustify;
            }
        }
        /// <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 OnToggleStrikethroughCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            ICheckableCommandParameter parameter = e.Parameter as ICheckableCommandParameter;

            if (parameter != null)
            {
                parameter.Handled   = true;
                parameter.IsChecked = this.SelectionStrikethrough;
            }
            e.CanExecute = true;
            e.Handled    = true;
        }
Example #4
0
        /// <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 toggleContextualTabGroupCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
            e.Handled    = true;

            ICheckableCommandParameter parameter = e.Parameter as ICheckableCommandParameter;

            if (parameter != null)
            {
                RibbonControls.ContextualTabGroup contextualTabGroup = ribbon.ContextualTabGroups[Convert.ToString(parameter.Tag)];
                parameter.Handled   = true;
                parameter.IsChecked = contextualTabGroup.IsVisible;
            }
        }
Example #5
0
        /// <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 toggleContextualTabGroupCommand_Execute(object sender, ExecutedRoutedEventArgs e)
        {
            RibbonControls.ContextualTabGroup contextualTabGroup = null;

            ICheckableCommandParameter parameter = e.Parameter as ICheckableCommandParameter;

            if (parameter != null)
            {
                contextualTabGroup = ribbon.ContextualTabGroups[Convert.ToString(parameter.Tag)];
            }
            else if (e.Parameter is string)
            {
                contextualTabGroup = ribbon.ContextualTabGroups[Convert.ToString(e.Parameter)];
            }

            if (contextualTabGroup != null)
            {
                contextualTabGroup.IsActive = !contextualTabGroup.IsActive;

                // If making active, select the first tab in it
                // if ((contextualTabGroup.IsActive) && (contextualTabGroup.Items.Count > 0))
                //	ribbon.SelectedTab = (RibbonControls.Tab)contextualTabGroup.Items[0];
            }
        }