Exemple #1
0
        private void TreeList_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            TreeListItem item = WpfUtil.GetTreeListItem(e.OriginalSource);

            if (item == null)
            {
                e.Handled = true;
                return;
            }

            TreeList list = (TreeList)sender;

            if (list.SelectedItem != null)
            {
                return;
            }

            Point         pt     = e.GetPosition((UIElement)sender);
            HitTestResult result = VisualTreeHelper.HitTest(list, pt);

            if (result != null)
            {
                item = WpfUtil.GetTreeListItem(result.VisualHit);
                if (item != null)
                {
                    item.IsSelected = true;
                }
            }
        }
Exemple #2
0
        private void FileTreeView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TreeListItem item = WpfUtil.GetTreeListItem(e.OriginalSource);

            if (item == null)
            {
                return;
            }

            FileComponent file = FileController.SelectedItem;

            if (file != null)
            {
                if (file.File)
                {
                    file.Open();
                }
                else
                {
                    TreeNode node = FileTreeView.SelectedNode;
                    if (node != null)
                    {
                        FileTreeView.SetIsExpanded(node, !node.IsExpanded);
                    }
                }
            }

            FileTreeView.UnselectAll();
        }
Exemple #3
0
        private void TreeList_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TreeListItem item = WpfUtil.GetTreeListItem(e.OriginalSource);

            if (item == null)
            {
                TreeList list = (TreeList)sender;
                list.UnselectAll();
                e.Handled = true;
            }
        }
Exemple #4
0
        private void BrowseTreeView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TreeListItem item = WpfUtil.GetTreeListItem(e.OriginalSource);

            if (item == null)
            {
                return;
            }

            BrowseComponent browse = BrowseController.SelectedItem;

            if (browse != null)
            {
                if (browse.File)
                {
                    DownloadController.Download(browse);
                }
                else
                {
                    TreeNode node = BrowseTreeView.SelectedNode;

                    if (node != null)
                    {
                        if (Application.Current != null)
                        {
                            Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(delegate
                            {
                                BrowseTreeView.SetIsExpanded(node, !node.IsExpanded);
                            }));
                        }
                    }
                }
            }

            BrowseTreeView.UnselectAll();
        }