/// <summary> /// Initialize tree control. /// </summary> public BaseTreeCtrl() { InitializeComponent(); DataContext = NodesTV = new TreeViewPageViewModel(); ContainerGrid.Children.Clear(); NodesTV.TreeItems?.Clear(); ContainerGrid.Children.Add(TV = (TreeView)this.TreeViewTemplate.LoadContent()); NodesTV.OnLoadChildrenAsync += BeforeExpand; }
/// <summary> /// Adds the current element to the collection of selected items. /// </summary> /// <remarks> /// This API supports the .NET Framework infrastructure and is not /// intended to be used directly from your code. /// </remarks> void ISelectionItemProvider.AddToSelection() { TreeViewItem owner = OwnerTreeViewItem; TreeView parent = owner.ParentTreeView; if (parent == null || (parent.SelectedItem != null && parent.SelectedContainer != Owner)) { throw new InvalidOperationException("Controls.Properties.Resources.Automation_OperationCannotBePerformed"); } owner.IsSelected = true; }
/// <summary> /// Scrolls the content area of a container object in order to display /// the control within the visible region (viewport) of the container. /// </summary> /// <remarks> /// This API supports the .NET Framework infrastructure and is not /// intended to be used directly from your code. /// </remarks> void IScrollItemProvider.ScrollIntoView() { // Note: WPF just calls BringIntoView on the current TreeViewItem. // This actually raises an event that can be handled by the // its containers. Silverlight doesn't support this, so we will // approximate by moving scrolling the TreeView's ScrollHost to the // item. // Get the parent TreeView TreeViewItem owner = OwnerTreeViewItem; TreeView parent = owner.ParentTreeView; if (parent == null) { return; } // Scroll the item into view parent.ItemsControlHelper.ScrollIntoView(owner); }
private void NewTreeView() { this.ContainerGrid.Children.Clear(); vm.TreeItems?.Clear(); this.ContainerGrid.Children.Add(tvDataBound = (TreeView)this.TreeViewTemplate.LoadContent()); }
/// <summary> /// Initializes a new instance of the /// <see cref="T:System.Windows.Automation.Peers.TreeViewAutomationPeer" /> /// class. /// </summary> /// <param name="owner"> /// The <see cref="T:WinRTXamlToolkit.Controls.TreeView" /> to associate /// with the /// <see cref="T:System.Windows.Automation.Peers.TreeViewAutomationPeer" />. /// </param> public TreeViewAutomationPeer(TreeView owner) : base(owner) { }