Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Make TreeView.SelectedItem a DependencyProperty #2458

Closed
quinmars opened this issue May 16, 2020 · 14 comments · Fixed by #2523 or #3897
Closed

Proposal: Make TreeView.SelectedItem a DependencyProperty #2458

quinmars opened this issue May 16, 2020 · 14 comments · Fixed by #2523 or #3897
Assignees
Labels
area-TreeView feature proposal New feature proposal team-Controls Issue for the Controls team

Comments

@quinmars
Copy link

Proposal: 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.

@quinmars quinmars added the feature proposal New feature proposal label May 16, 2020
@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label May 16, 2020
@MartinZikmund
Copy link
Contributor

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 😀

@marcelwgn
Copy link
Collaborator

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.

@dpaulino
Copy link
Contributor

Yes please

@ranjeshj ranjeshj added area-TreeView team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels May 18, 2020
@ranjeshj
Copy link
Contributor

@MikeHillberg graciously offered to do the spec work for this. Thanks! @dpaulino/@chingucoding, would one of you be able to create a PR ?

@marcelwgn
Copy link
Collaborator

If @dpaulino does not want to create a PR I would step in, but I'll leave it up to @dpaulino to decide :)

@dpaulino
Copy link
Contributor

@chingucoding unfortunately don't have bandwidth this week. Please feel free to take this Marcel

@marcelwgn
Copy link
Collaborator

Right, will do. Thanks.

@marcelwgn
Copy link
Collaborator

While we are at it, should SelectedNode also become a DP?

@ranjeshj
Copy link
Contributor

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.

@quinmars
Copy link
Author

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!

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label May 29, 2020
@ranjeshj ranjeshj removed the needs-triage Issue needs to be triaged by the area owners label Jun 3, 2020
@sis2004
Copy link

sis2004 commented Dec 16, 2020

As I reported under another issue, I tried to upgrade to the recent stable release 2.5.0, and discovered that TreeView.SelectedItem is still not recognized as a dependency property there, apparently due to the fact that it was never moved out of preview.

@ranjeshj, @StephenLPeters and @MikeHillberg - can you tell why it's still in preview and when it might get moved out of preview?

This is critical for us, since we'd be stuck with using a pre-release version, which has its own set of issues.

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Dec 16, 2020
@StephenLPeters
Copy link
Contributor

I'm not sure why it wasn't included in the 2.5 release. I'll talk to the team, maybe we can include this in a later patch to the 2.5 release. No promises though.

@ranjeshj
Copy link
Contributor

ranjeshj commented Jan 6, 2021

The spec is already updated. @chingucoding can you move this API out of preview ? Thanks!

@marcelwgn
Copy link
Collaborator

Sure, I'll create a PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TreeView feature proposal New feature proposal team-Controls Issue for the Controls team
Projects
None yet
9 participants