本文整理汇总了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));
}
示例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);
}
}));
}
示例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;
}