Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Is there no way to provide separate datatemplates for nodes in a XamDiagram based on class type?
posted

Many other infragistics controls like xamNetworkNode and xamTileManager let you provide different templates based on class. This is really nice because you can have a collection of a base class and then select the datatemplate by the derived type. 

I see examples on the forums of manually applying a datatemplate but this should be something the xamDiagram can do on its own.

Am I missing something?

  • 34430
    Offline posted

    Hello Matt,

    In order to provide separate data templates for nodes in a XamDiagram based on type, I would recommend defining first binding the ItemsSource of the XamDiagram to a collection of your types, and then defining a NodeDefinition for each of those types within the XamDiagram.NodeDefinitions collection. The NodeDefinition has a TargetType property that you can set for your different types, and then nodes will be created for those types.

    The NodeDefinition also has a NodeStyle property, and if you set this to a new Style for DiagramNode, you can define a different DisplayTemplate or EditTemplate for your nodes. For more about binding data in the XamDiagram, I would recommend seeing this online documentation article.

    I have attached a sample project binding two separate types to the XamDiagram and creating a different DisplayTemplate for them. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    XamDiagramDifferentDataTypesDemo.zip