![]() ![]() / Gets the IsItemSelected value from the specified target. New FrameworkPropertyMetadata(OnIsItemSelectedChanged)) "IsItemSelected", typeof(bool), typeof(TreeViewMultipleSelectionBehavior), Public static readonly DependencyProperty IsItemSelectedProperty = DependencyProperty.RegisterAttached( / The dependency property definition for the IsItemSelected attached property. #region IsItemSelected (TreeViewItem Attached Property) #endregion AnchorItem (Private Dependency Property) "SelectedItems", typeof(IList), typeof(TreeViewMultipleSelectionBehavior)) Public static readonly DependencyProperty SelectedItemsProperty = DependencyProperty.Register( / The dependency property definition for the SelectedItems property. #region SelectedItems (Public Dependency Property) Public class TreeViewMultipleSelectionBehavior : Behavior / A behavior that extends a with multiple selection capabilities. The living code can be found within CodeMaid’s open source repository here.Īnd just in case, here’s a static snapshot of the code: Here’s a little example of it working in action: Multi-Select Our solution converted this to a behavior and added support for arrow keys and the space bar for more keyboard navigation scenarios. There’s several different solutions out there, and in particular our implementation is largely based on the great work of Cristoph Gattnar available here.Ĭhristoph’s solution utilizes attached properties. To support enhancements like dragging and dropping multiple items at once to CodeMaid‘s Spade tool window, we wanted this capability to multi select. By multiple selection I mean holding down the control key or shift key to select a set of items, similar to behavior available in other controls such as Windows Explorer. ![]() The WPF TreeView is very powerful, but out of the box it doesn’t support selecting multiple items at once. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |