本文整理汇总了C#中System.Windows.Controls.UserControl.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# UserControl.Focus方法的具体用法?C# UserControl.Focus怎么用?C# UserControl.Focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.UserControl
的用法示例。
在下文中一共展示了UserControl.Focus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseModalWindow
public BaseModalWindow(UserControl control)
: this()
{
this.Content.Children.Add(control);
control.Focus();
}
示例2: DeleteNodes
public void DeleteNodes(UserControl sender = null)
{
if (HasInvisibleNodesSelected())
{
SuperMessageBoxService.ShowWarning("Delete Node(s)",
"Some hidden nodes have been selected, are you sure you wish to delete them? \r\n\r\n" +
"Press YES to delete them\r\n" +
"Press NO to show all hidden nodes",
"Yes",
"No",
"Cancel",
DeleteAllNodes,
() =>
{
foreach (var nodeControl in NodeControls)
{
if (nodeControl.CollapseState == CollapseState.Collapsed ||
nodeControl.CollapseState == CollapseState.SemiCollapsed)
{
var control = nodeControl as NodeControl;
if (control != null && control.GetAllChildNodeControls().Any(q => q.ViewModelNode.IsSelected))
{
control.CollapseControl.ExpandNodes(new ChildrenControlCollection(control));
}
}
}
if (sender != null)
{
sender.Focus();
}
},
() =>
{
if (sender != null)
{
sender.Focus();
}
});
}
else
{
if (NodeControls.Any(q => q.CollapseState == CollapseState.Collapsed || q.CollapseState == CollapseState.SemiCollapsed))
{
SuperMessageBoxService.ShowWarning("Delete Node(s)",
"The selected node(s) have hidden related node(s), are you sure you wish to delete your selection? \r\n\r\n" +
"Press YES to delete the selected node(s) then show the hidden node(s)\r\n" +
"Press NO to just show the hidden node(s)",
"Yes",
"No",
"Cancel",
() =>
{
DeleteAllNodes();
SelectorControl.RecheckIncorrectVisibility();
SelectorControl.ReScanForCollapseStates();
},
() =>
{
foreach (var nodeControl in NodeControls)
{
if (nodeControl.CollapseState == CollapseState.Collapsed ||
nodeControl.CollapseState == CollapseState.SemiCollapsed)
{
var control = nodeControl as NodeControl;
if (control != null)
{
control.CollapseControl.ExpandNodes(new ChildrenControlCollection(control, false, true));
}
}
}
if (sender != null)
{
sender.Focus();
}
},
() =>
{
if (sender != null)
{
sender.Focus();
}
});
}
else
{
DeleteAllNodes();
}
}
}