Hello,
I am having difficulties binding to the data of the active node on the xamDataTree.
Last thing I was stuck with is (but what doesn't work):
<TextBlock Text="{Binding Path=Data.Name}" DataContext="{Binding Path=ActiveNode, ElementName=modelerTree}" Grid.Row="1" x:Name="textblock"/>
<XamDataTree x:Name="modelerTree">... </XamDataTree>
I tried binding to only the tree, to the ActiveNode (hoping propertychanged would notify binding to update) and to ActiveNode.Data and also binding without datacontext directly to Text={Binding Path=ActiveNode.Data.Name, ElementName=modelerTree}. But nothing seems to work.
With snoop I was able to verify that the active node and the contained data on the tree is always correct. But the property does not get updated in my binding.
The workaround right now is to catch the ActiveNodeChanged-Event in the code behind and set the datacontext to
e.NewActiveTreeNode.Data.
But it would be nice to do that in xaml..
Any help will be appreciated.
Peter.
Hello Peter,
Thank you for your post. I have logged this behavior with our developers in our tracking system, with an issue ID of 119305. I have also created a support ticket on your behalf with number CAS-98481-Q3G7S3 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
The development issue with ID of 119305 has been fixed and it is available in the latest Service Release. You can download the Service Release by logging in our web site and then going to Account\My Keys and Downloads page.
Thank you for using Infragistics Components.
Infragistics
Hi Krasimir,
sorry it took so long for me to check back on this. I went to the "Keys and downloads" section to download the service release. But I had no entries on that page or any options to download anything. Also the link to the download in another email was broken (http://ko.infragistics.com/Membership/Default.aspx?panel=Downloads).
Can you point me to the proper location to download the service release?
Thanks,
Peter
Thank you for your reply. I can suggest continuing our discussion regarding this matter, through the private support ticket that I have created for you.
Please let me know if you need any further assistance on this matter.
I was finally able to downloaded the latest NetVantage 12.2 and install the Service Release 2022. But somehow it still does not seem to work the way I thought it would.
I tried to bind the ActiveNode of the XamDataTree to my ViewModel, in order to get notification of changes and work with the selected object.
<ig:XamDataTree ItemsSource="{Binding EmsItems}" ActiveNode="{Binding ActiveTreeNode}" />
This throws me an exception, that no binding can be established because bindings are only supported for dependencyproperties of dependencyobjects.
Does this mean I have to continue using the ActiveNodeChangedEvent and then propagate the active node to my viewmodel in code behind, or did I miss something?
Best Regards,
Thank you for your reply. Please let me know if you need any further assistance on the matter.
Hey Krasimir,
thank you for your reply. That answers all my questions.
Best regards,
Thank you for your replies. I have been looking into the functionality that you are trying to achieve and the XamDataTree does not currently supports binding to the ActiveNode property, since the property is not a DependenyProperty. If you wish to bind be able to detect the changes of the active node in the view model, I can suggest using the approach described in the following forum thread: http://ko.infragistics.com/community/forums/t/58081.aspx. This approach shows how you can create a class that derives from the XamDataTree and expose a bindable property of type object, which corresponds to the data item of the ActiveNode of the XamDataTree and can be bound to your ViewModel with TwoWay mode. When the ActiveNode of the XamDataTree changes the SelectedItem property updates the property of the ViewModel and also when you set the property of the ViewModel, the XamDataTree’s ActiveNode is changed.
Please let me know if you need any further assistance on the matter.
Although it did not work as expected (i.e. like in a listbox, where you can bind your selected item to the view model), the ServiceRelease fixed the binding to the active node via the ElementName syntax.
So I can do something like this:
<ig:XamDataTree ItemsSource="{Binding EmsItems}" x:Name="tree" Grid.Row="1"/> <TextBox Text="{Binding ActiveNode.Data.StringValue,ElementName=tree}" Grid.Row="2"/>
So I'm going to mark this release to solve the issue.
Thank you for your efforts!