Hello Syncfusion staff,
I have a custom ConectorViewModel that accepts other connections from and to nodeViewModels. I need to expose those links; thus, being able to modify their style. “This.Ports” collection seems the most probable way of doing it, but it is not an iterable object. So, I would like to know how to get those connections. If possible, would you mind including a code example?
Thank you,
Tomas.
Hello Karkuvel,,
The provided solution does not satisfy the requirement. I need to detect all the connectors that are connected to the custom ConnectorViewModel, and to list them, so I can change their styles and track to which node they are linked from the custom Connector.
Thank you,
Tomas.
ObservableCollection<ConnectorViewModel> RelatedConnectors = new ObservableCollection<ConnectorViewModel>();
private void ChangeStyle_Click(object sender, RoutedEventArgs e)
{
if((Diagram.SelectedItems as SelectorViewModel).SelectedItem is ConnectorViewModel)
{
ConnectorViewModel selectedconnector = (Diagram.SelectedItems as SelectorViewModel).SelectedItem as ConnectorViewModel;
if(selectedconnector.Ports != null && selectedconnector.Ports is PortCollection)
{
foreach(ConnectorPortViewModel port in selectedconnector.Ports as PortCollection)
{
foreach(ConnectorViewModel conns in (port.Info as IConnectorPortInfo).InConnectors as IEnumerable<IConnector>)
{
RelatedConnectors.Add(conns);
}
foreach (ConnectorViewModel conns in (port.Info as IConnectorPortInfo).OutConnectors as IEnumerable<IConnector>)
{
RelatedConnectors.Add(conns);
}
}
}
}
}
|