We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Binding to SelectedItems property

Thread ID:





127572 Nov 24,2016 11:18 AM UTC Dec 8,2016 04:47 AM UTC WPF 3
Tags: SfDiagram
Asked On November 24, 2016 11:18 AM UTC


Q: What is a proper way to bind SfDiagram.SelectedItems property to ViewModel's corresponding property?
Tried the following:


    <sf:Selector DataContext="{Binding SelectedItems}"/>

(assuming that DataContext is a VM object)

In VM:

private SelectorViewModel selectedItems = new SelectorViewModel() {
Nodes = new ObservableCollection<NodeViewModel>(),
Connectors = new ObservableCollection<ConnectorViewModel>();
public SelectorViewModel SelectedItems {
get { return selectedItems; }
set {
selectedItems = value;

but getting an Exception after trying to select something (even the diagram itself).

Ranjitha Amirthalingam [Syncfusion]
Replied On December 1, 2016 09:33 AM UTC

Hi Artemy, 
Thanks for Contacting Syncfusion Support. 
Requirement: To bind the custom ViewModel for Selected Items. 
The SelectedItems property of SfDiagram is type of SelectorViewModel which is the default DataContext of Selector. We assumed that your requirement is to bind the SelectorViewModel (from ViewModel class) to SelectedItems property of SfDiagram. We have represented this in simple sample. Please refer to that as below. 
Sample Details: 
We have created ViewModel (named as “DiagramVM”) for Diagram with Custom property for SelectedItems. 
Ranjitha A. 

Replied On December 6, 2016 11:31 AM UTC

Thank you 

Keerthivasan Ramamoorthy [Syncfusion]
Replied On December 8, 2016 04:47 AM UTC

Hi Artemy,  
Thanks for the update.  
Please let us know if you need any other assistance.   
Keerthivasan R.   


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon