question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Make TreeView.SelectedItem a DependencyProperty

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
quinmarscommented, May 29, 2020

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!

1reaction
chingucodingcommented, Jan 6, 2021

Sure, I’ll create a PR shortly.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found