static void buttonCustomAction_ItemClick_Commands(object sender, ItemClickEventArgs e) { RichEditControl richEdit = e.Item.Tag as RichEditControl; richEdit.SelectAll(); RichEditCommand capCommand = richEdit.CreateCommand(RichEditCommandId.CapitalizeEachWordTextCase); capCommand.ForceExecute(capCommand.CreateDefaultCommandUIState()); RichEditCommand boldCommand = richEdit.CreateCommand(RichEditCommandId.ToggleFontBold); boldCommand.ForceExecute(boldCommand.CreateDefaultCommandUIState()); RichEditCommand changeFontColorCommand = richEdit.CreateCommand(RichEditCommandId.ChangeFontBackColor); DevExpress.Utils.Commands.ICommandUIState state = changeFontColorCommand.CreateDefaultCommandUIState(); state.EditValue = Color.Yellow; changeFontColorCommand.ForceExecute(state); RichEditCommand previewCommand = richEdit.CreateCommand(RichEditCommandId.PrintPreview); previewCommand.ForceExecute(previewCommand.CreateDefaultCommandUIState()); richEdit.DeselectAll(); }
public override void UpdateUIState(DevExpress.Utils.Commands.ICommandUIState state) { base.UpdateUIState(state); // Disable a command if there is nothing to save if (state.Enabled) { state.Enabled = Control.Document.Selection.Length > 0; } }
public override void UpdateUIState(DevExpress.Utils.Commands.ICommandUIState state) { base.UpdateUIState(state); // Check for access to special folders if (state.Enabled) { state.Enabled = Application.Current.HasElevatedPermissions; } }
public void UpdateCommandUIState(DevExpress.Utils.Commands.Command command, DevExpress.Utils.Commands.ICommandUIState state) { if (!(command is RichEditCommand richEditCommand)) { return; } if (richEditCommand.Id == SnapCommandId.NewDataSource) { state.Enabled = false; state.Visible = false; } else if (richEditCommand.Id == SnapCommandId.MailMergeDataSource) { state.Enabled = false; state.Visible = false; } }
public override void EndCommandExecution(DevExpress.Utils.Commands.Command command, DevExpress.Utils.Commands.ICommandUIState state) { base.EndCommandExecution(command, state); if (!RichEditControl.IsUpdateLocked) { RaiseCommandExecutedEvent(new CommandEventArgs(command.ToString(), command.Description)); } }
public override void ForceExecute(DevExpress.Utils.Commands.ICommandUIState state) { base.ForceExecute(state); }
public override void ForceExecute(DevExpress.Utils.Commands.ICommandUIState state) { Control.Document.InsertText(Control.Document.CaretPosition, Clipboard.GetText()); }