当前位置: 首页>>代码示例>>C#>>正文


C# UserControl.Focus方法代码示例

本文整理汇总了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();
 }
开发者ID:Deli-SK,项目名称:NSA-Edge,代码行数:6,代码来源:BaseModalWindow.xaml.cs

示例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();
                }
            }


            
        }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:92,代码来源:NodesSelector.cs


注:本文中的System.Windows.Controls.UserControl.Focus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。