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


C# TreeView.AddHandler方法代码示例

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


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

示例1: ConnectionsTreeController

        public ConnectionsTreeController(TreeView connectionsTreeView)
        {
            _treeView = connectionsTreeView;
            _treeView.SelectedItemChanged += new RoutedPropertyChangedEventHandler<object>(SelectionChanged);

            SettingsManager.Instance.ConnectionChanged += new SettingChangedEventHandler<ConnectionInfo>(Settings_ConnectionChanged);

            SettingsManager.Instance.Connections.ToList().ForEach(cnnInfo => DisplayConnection(cnnInfo));

            _treeView.AddHandler(TreeViewItem.ExpandedEvent, new RoutedEventHandler(Expanded));
            _treeView.AddHandler(TreeViewItem.ExpandedEvent, new RoutedEventHandler(Collapsed));
        }
开发者ID:stevehjohn,项目名称:Hub,代码行数:12,代码来源:ConnectionsTreeController.cs

示例2: CreateTreeView

        private void CreateTreeView()
        {
            System.Uri resourceLocater = new System.Uri("/DataSpaceSync;component/FolderTreeMVC/TreeView.xaml", System.UriKind.Relative);
            treeView = Application.LoadComponent(resourceLocater) as TreeView;

            repo = new CmisSync.CmisTree.RootFolder()
            {
                Name = FolderName,
                Id = Credentials.RepoId,
                Address = Credentials.Address.ToString()
            };

            ObservableCollection<RootFolder> repos = new ObservableCollection<RootFolder>();
            repos.Add(repo);
            repo.Selected = true;

            asyncLoader = new AsyncNodeLoader(repo, Credentials, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
            IgnoredFolderLoader.AddIgnoredFolderToRootNode(repo, Ignores);
            LocalFolderLoader.AddLocalFolderToRootNode(repo, localPath);
            asyncLoader.Load(repo);

            treeView.DataContext = repos;

            treeView.AddHandler(TreeViewItem.ExpandedEvent, new RoutedEventHandler(delegate(object sender, RoutedEventArgs e)
            {
                TreeViewItem expandedItem = e.OriginalSource as TreeViewItem;
                Node expandedNode = expandedItem.Header as Folder;
                if (expandedNode != null)
                {
                    asyncLoader.Load(expandedNode);
                }
            }));
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:33,代码来源:Edit.cs

示例3: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _filesListView = GetTemplateChild("PART_Files") as ListView;
            _filesListView.MouseDoubleClick += FilesListView_MouseDoubleClick;

            _folderTreeView = GetTemplateChild("PART_FolderTreeView") as TreeView;

            _folderTreeView.SelectedItemChanged += FolderTreeView_SelectedItemChanged;
            _folderTreeView.AddHandler(TreeViewItem.ExpandedEvent, new RoutedEventHandler(FolderTreeView_Expanded));

            _folderTreeView.Items.Add(new Folder(System.IO.Path.Combine
                    (Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Links"), null));
            foreach (var drive in Directory.GetLogicalDrives())
                _folderTreeView.Items.Add(new Folder(drive, null));

            this.MouseUp += FileDialog_MouseUp;
        }
开发者ID:chris84948,项目名称:WPF-File-Dialog-Control,代码行数:19,代码来源:FileDialog.cs


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