Example #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;
                        }
                    }
                }
            }
        }
Example #2
0
        private static void PropagateDragNDropCmd(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TreeViewExt tve = d as TreeViewExt;

            if (tve != null)
            {
                foreach (object item in tve.Items)
                {
                    TreeViewItemExt tvie = tve.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItemExt;
                    if (tvie != null)
                    {
                        tvie.DragNDropCmd = tve.DragNDropCmd;
                    }
                }
            }
        }