TreeView.SelectedItem
a DependencyProperty
The TreeView.SelectedItem property is not a DP, hence it is not possible to bind to the view model with the TwoWay
mode.
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
.
I am all for this proposal, I spent quite a few minutes trying to understand why my binding was not working until I found out it is not in fact a dependency property 馃榾
Yes, this should definitely be a DP in my opinion.
If this proposal get's accepted, I think it would be pretty straightforward to implement.
Yes please
@MikeHillberg graciously offered to do the spec work for this. Thanks! @dpaulino/@chingucoding, would one of you be able to create a PR ?
If @dpaulino does not want to create a PR I would step in, but I'll leave it up to @dpaulino to decide :)
@chingucoding unfortunately don't have bandwidth this week. Please feel free to take this Marcel
Right, will do. Thanks.
While we are at it, should SelectedNode
also become a DP?
SelectedItem is definitely useful as a dependency property so that it can be bound. I'm not sure if there is much use making SelectedNode a dependency property. I might be wrong.
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!
Most helpful comment
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!