Proposal: Make TreeView.SelectedItem a DependencyProperty
See original GitHub issueProposal: Make TreeView.SelectedItem
a DependencyProperty
Summary
The TreeView.SelectedItem property is not a DP, hence it is not possible to bind to the view model with the TwoWay
mode.
Rationale
One common pattern for a list or tree view is the master detail pattern. The user selects an item from an items view (ListView
, ComboBox
, ListBox
, TreeView
etc.) and in a secondary view more details for the given item are presented, for example the body of an email, the content of a directory or the article of an rss feed. In order for the view model to retrieve the selected email from the server, it must know if and which email was selected in the list/tree.
In most, if not all, other items controls, the SelectedItem
property is infact a DependencyProperty
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:14 (12 by maintainers)
Top Results From Across the Web
Data binding to SelectedItem in a WPF Treeview
We need two things: Create a dependency property in the viewmodel (in my case of type 'MyObject' as my treeview is bound to...
Read more >TreeView SelectedItem doesn't work in UI for WPF
So I have implemented your tree and am trying to use that property to set the item, but I cannot get it to...
Read more >[Solved]-Data binding to SelectedItem in a WPF Treeview-wpf
Create a dependency property in the viewmodel (in my case of type 'MyObject' as my treeview is bound to object of the 'MyObject'...
Read more >TreeView.SelectedItem Property (System.Windows.Controls)
The SelectedItem property on the TreeView control is a read-only property and is set to an item when the IsSelected property value of...
Read more >TreeViewControl Class | WPF Controls
This is a dependency property. EnableDynamicLoading, Gets or sets whether to create nodes dynamically when you expand their parent node. This is a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I really like your open source spirit. I had a similar issue with WPF a few years ago. But I would never have thought of reporting this. I would not have even known where. And here it was solved in less than two weeks. Thank you very much!
Sure, I’ll create a PR shortly.