本文整理汇总了C#中System.Windows.Input.RoutedCommand.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# RoutedCommand.Execute方法的具体用法?C# RoutedCommand.Execute怎么用?C# RoutedCommand.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Input.RoutedCommand
的用法示例。
在下文中一共展示了RoutedCommand.Execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
void Run(RoutedCommand command)
{
if (command.CanExecute(null, null)) {
command.Execute(null, null);
} else if (this.Child != null) {
command.Execute(null, FocusManager.GetFocusedElement(FocusManager.GetFocusScope(this.Child)));
}
}
示例2: EndEdit
private bool EndEdit(RoutedCommand command, DataGridCell cellContainer, DataGridEditingUnit editingUnit, bool exitEditMode)
{
bool cellLeftEditingMode = true;
bool rowLeftEditingMode = true;
if (cellContainer != null)
{
if (command.CanExecute(editingUnit, cellContainer))
{
command.Execute(editingUnit, cellContainer);
}
cellLeftEditingMode = !cellContainer.IsEditing;
rowLeftEditingMode = !IsEditingRowItem && !IsAddingNewItem;
}
if (!exitEditMode)
{
if (editingUnit == DataGridEditingUnit.Cell)
{
if (cellContainer != null)
{
if (cellLeftEditingMode)
{
return BeginEdit(null);
}
}
else
{
// A cell was not placed in edit mode
return false;
}
}
else
{
if (rowLeftEditingMode)
{
object rowItem = cellContainer.RowDataItem;
if (rowItem != null)
{
EditRowItem(rowItem);
return IsEditingRowItem;
}
}
// A row item was not placed in edit mode
return false;
}
}
return cellLeftEditingMode && ((editingUnit == DataGridEditingUnit.Cell) || rowLeftEditingMode);
}
示例3: SetColor
private Boolean SetColor(Object color, RoutedCommand cmd)
{
RichTextBox editor = this.CurrentEditor;
Color? newColor = null;
if (color is PropertyInfo)
{
newColor = ((PropertyInfo)color).GetValue(null) as Color?;
}
else if (color is Color)
{
newColor = (Color)color;
}
else
{
throw new ArgumentException("color");
}
if (cmd != null && editor != null && newColor != null)
{
cmd.Execute(
(Color)newColor, editor);
editor.Focus();
this.IsOverflowOpen = false;
return true;
}
return false;
}
示例4: Execute
void Execute(RoutedCommand command)
{
TextArea textArea = this.TextArea;
if (textArea != null) {
command.Execute(null, textArea);
}
}