コード例 #1
0
        /// <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;

            UiCore.Controls.TreeView.TreeView parent = owner.ParentTreeView;
            if (parent == null || (parent.SelectedItem != null && parent.SelectedContainer != Owner))
            {
                throw new InvalidOperationException("Controls.Properties.Resources.Automation_OperationCannotBePerformed");
            }
            owner.IsSelected = true;
        }
コード例 #2
0
        /// <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;

            UiCore.Controls.TreeView.TreeView parent = owner.ParentTreeView;
            if (parent == null)
            {
                return;
            }

            // Scroll the item into view
            parent.ItemsControlHelper.ScrollIntoView(owner);
        }