Dear Sir,I am using xamdatatree. I want a property which is IsSelected which is TreeView (wpf control). Based on Isselected property i am adding child but i am unable to bind that property for xamdatatree,So plz help me to solve this problem.
Hello shankarnag,
Would you please provide me with a test sample which represents your scenario, or modify the one that I sent to you, so I can be able to suggest you more accurate approach to achieve this functionality depending on the properties your viewmodel.
Thanks in advance.
Dear Madam, No.... Issues is not solved.Actually wat u have sent an example is good, but in my case i should change the viewmodel.So is it any possible to do in xaml only other than doing in cs file?
I am just checking have you been able to resolve your issue? If you still need any assistance on the matter do not hesitate to ask.
In order to get the current node you can implement functionality that checks which node was selected. This can be done by raising the PropertyChanged event on the current XamNode. You can achieve this by holding a reference of this node in your ViewModel class. A good point at which you can set this node reference is when the nodes are been initialized, or on InitializeNode event. This event is raised when a parent node have is expanded or on initializing the root node when the application is started for the first time.
Please find the attached a sample project(TestTreeView) that demonstrates how to implement the suggested custom approach. The sample shows both cases if event was fired after a user action (click on some node), or in case the node was expanded in the code behind. In the above mentioned example the user can type a path to a particular node. In the code behind the parent nodes will be expanded programmatically causing InitializeNode event to be triggered which will lead to the chain method calls in the ViewModel class.
In case you have any further questions, please do not hesitate to ask.