Exemplo n.º 1
0
        public TPayload GetAncestorPayload <TPayload>()
        {
            TreeNodeViewModel ancestor = this.Parent;

            while (ancestor != null)
            {
                if (ancestor.NodePayload is TPayload payload)
                {
                    return(payload);
                }
                ancestor = ancestor.Parent;
            }
            return(default);
Exemplo n.º 2
0
 private void TreeView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (e.ClickCount > 1) // check if it is double click
     {
         e.Handled = true;
         TreeNodeViewModel viewModel = this.DataContext as TreeNodeViewModel;
         if (viewModel == null)
         {
             return;
         }
         TreeView item = sender as TreeView;
         if (item == null)
         {
             return;
         }
         if (item.SelectedItem == null)
         {
             return;
         }
         //viewModel.TreeViewDoubleClickCommand.Execute(item.SelectedItem);
     }
 }