/// <summary> /// Initializes a new instance of the /// <see cref="T:WinRTXamlToolkit.Controls.TreeView" /> class. /// </summary> public TreeView() { var pcc = new PropertyChangeEventSource <Style>(this, "ItemContainerStyle"); pcc.ValueChanged += OnItemContainerStylePropertyChanged; DefaultStyleKey = typeof(TreeView); ItemsControlHelper = new ItemsControlHelper(this); Interaction = new InteractionHelper(this); }
/// <summary> /// Initializes a new instance of the /// <see cref="T:WinRTXamlToolkit.Controls.TreeView" /> class. /// </summary> public TreeView() { var pcc = new PropertyChangeEventSource<Style>(this, "ItemContainerStyle"); pcc.ValueChanged += OnItemContainerStylePropertyChanged; DefaultStyleKey = typeof(TreeView); ItemsControlHelper = new ItemsControlHelper(this); Interaction = new InteractionHelper(this); }
/// <summary> /// Handle keys related to scrolling. /// </summary> /// <param name="key">The key to handle.</param> /// <returns>A value indicating whether the key was handled.</returns> private bool HandleScrollKeys(VirtualKey key) { ScrollViewer scrollHost = ItemsControlHelper.ScrollHost; if (scrollHost != null) { // Some keys (e.g. Left/Right) need to be translated in RightToLeft mode VirtualKey invariantKey = InteractionHelper.GetLogicalKey(FlowDirection, key); switch (invariantKey) { case VirtualKey.PageUp: // Move horizontally if we've run out of room vertically if (!NumericExtensions.IsGreaterThan(scrollHost.ExtentHeight, scrollHost.ViewportHeight)) { scrollHost.PageLeft(); } else { scrollHost.PageUp(); } return(true); case VirtualKey.PageDown: // Move horizontally if we've run out of room vertically if (!NumericExtensions.IsGreaterThan(scrollHost.ExtentHeight, scrollHost.ViewportHeight)) { scrollHost.PageRight(); } else { scrollHost.PageDown(); } return(true); case VirtualKey.Home: scrollHost.ScrollToTop(); return(true); case VirtualKey.End: scrollHost.ScrollToBottom(); return(true); case VirtualKey.Left: scrollHost.LineLeft(); return(true); case VirtualKey.Right: scrollHost.LineRight(); return(true); case VirtualKey.Up: scrollHost.LineUp(); return(true); case VirtualKey.Down: scrollHost.LineDown(); return(true); } } return(false); }
/// <summary> /// Initializes a new instance of the /// <see cref="T:WinRTXamlToolkit.Controls.TreeViewItem" /> class. /// </summary> public TreeViewItem() { DefaultStyleKey = typeof(TreeViewItem); Interaction = new InteractionHelper(this); }