Exemple #1
0
        private static void TransferBackToSelectedItem(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TreeViewExt tve = d as TreeViewExt;

            if (tve != null)
            {
                if (tve.SelectedItem_ == null)
                {
                    return;
                }

                TreeViewItem item = TreeViewQuery.ContainerFromItem(tve, tve.SelectedItem_);
                if (item != null)
                {
                    item.IsSelected = true;
                }
                else
                {
                    if (tve.Items.Count > 0)
                    {
                        item = (TreeViewItem)tve.ItemContainerGenerator.ContainerFromItem(tve.Items[0]);
                        if (item != null)
                        {
                            item.IsSelected = true;
                        }
                    }
                }
            }
        }
 private void TreeViewForMapping_Loaded(object sender, RoutedEventArgs e)
 {
     this.child_scroll_viewer = TreeViewQuery.GetScrollViewerChildOf(this);
     if (this.act_on_TreeViewItem_IsExpanded_changed != null && this.child_scroll_viewer != null)
     {
         this.child_scroll_viewer.ScrollChanged += child_scroll_viewer_ScrollChanged;
     }
 }
 private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e)
 {
     if (!(this.PassedEventHanlerToChildren))
     {
         foreach (object item in this.Items)
         {
             TreeViewItemForMapping tvi = TreeViewQuery.GetSelectedTreeViewItem(this, item) as TreeViewItemForMapping;
             if (tvi != null)
             {
                 tvi.ActOnTreeViewItemExpandedChangedHandler = this.ActOnTreeViewItemExpandedChangedHandler;
             }
             else
             {
                 this.PassedEventHanlerToChildren = false;
                 return;
             }
         }
         this.PassedEventHanlerToChildren = true;
     }
 }