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


C# TreeView.InputHitTest方法代码示例

本文整理汇总了C#中System.Windows.Controls.TreeView.InputHitTest方法的典型用法代码示例。如果您正苦于以下问题:C# TreeView.InputHitTest方法的具体用法?C# TreeView.InputHitTest怎么用?C# TreeView.InputHitTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.TreeView的用法示例。


在下文中一共展示了TreeView.InputHitTest方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTreeViewItemFromPoint

 // Static Methods
 private static TreeViewItem GetTreeViewItemFromPoint(TreeView treeView, Point point)
 {
     DependencyObject obj = treeView.InputHitTest(point) as DependencyObject;
     while (obj != null && !(obj is TreeViewItem))
         obj = VisualTreeHelper.GetParent(obj);
     return obj as TreeViewItem;
 }
开发者ID:Stranho,项目名称:bgda-explorer,代码行数:8,代码来源:FileTreeViewContextManager.cs

示例2: GetHoveredTreeViewItem

 private SiteExplorerNodeViewModel GetHoveredTreeViewItem(DragEventArgs e, TreeView tvw)
 {
     DependencyObject elem = tvw.InputHitTest(e.GetPosition(tvw)) as DependencyObject;
     while (elem != null && !(elem is TreeViewItem)) {
         elem = VisualTreeHelper.GetParent(elem);
     }
     var treeItem = elem as TreeViewItem;
     if (treeItem != null) {
         treeItem.Focus();
         return treeItem.DataContext as SiteExplorerNodeViewModel;
     }
     return null;
 }
开发者ID:kehh,项目名称:biolink,代码行数:13,代码来源:MaterialExplorer.xaml.cs

示例3: GetTreeViewItemClicked

 private TreeViewItem GetTreeViewItemClicked(FrameworkElement sender, TreeView treeView)
 {
     Point p = sender.TranslatePoint(new Point(1, 1), treeView);
     DependencyObject obj = treeView.InputHitTest(p) as DependencyObject;
     while (obj != null && !(obj is TreeViewItem)) {
         obj = VisualTreeHelper.GetParent(obj);
     }
     return obj as TreeViewItem;
 }
开发者ID:kehh,项目名称:biolink,代码行数:9,代码来源:TaxonExplorer.xaml.cs

示例4: GetExplorerTreeItem

 private ProfileExplorerTreeItem GetExplorerTreeItem(TreeView treeView, Point location)
 {
     IInputElement targetElement = treeView.InputHitTest(location);
     return GetExplorerTreeItem((UIElement)targetElement);
 }
开发者ID:Heliflyer,项目名称:helios,代码行数:5,代码来源:BindingsDragDropAdvisor.cs

示例5: CommonPreviewMouseMove

        private void CommonPreviewMouseMove(MouseEventArgs e, TreeView treeView)
        {
            if (_startPoint == null) {
                return;
            }

            if (e.LeftButton == MouseButtonState.Pressed && !_IsDragging) {
                Point position = e.GetPosition(treeView);
                if (Math.Abs(position.X - _startPoint.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(position.Y - _startPoint.Y) > SystemParameters.MinimumVerticalDragDistance) {
                    if (treeView.SelectedItem != null) {
                        IInputElement hitelement = treeView.InputHitTest(_startPoint);
                        TreeViewItem item = treeView.GetTreeViewItemClicked((FrameworkElement)hitelement);
                        if (item != null) {
                            StartDrag(e, treeView, item);
                        }
                    }
                }
            }
        }
开发者ID:kehh,项目名称:biolink,代码行数:19,代码来源:TaxonFavorites.xaml.cs


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