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
1925
XamDiagram Custom Toolbox
posted

Hi

I would like to have a toolbox with one custom category consisting my shapes bound to a collection in viewmodel. These items will be diagram node for which I can customize look and feel through style

I have looked at a related topic https://ko.infragistics.com/help/wpf/xamdiagram-configuring-the-toolbox

It does not show how to remove built-in shape categories. Is it possible to show just my own shapes category with nodes are items bound to a collection viewmodel and predefined style.

Thanks.

  • 34830
    Verified Answer
    Offline posted

    Hello Abs,

    In order to only show your own shapes category and remove the built-in shape categories for the XamDiagramToolbox via binding to a collection in your ViewModel, I would recommend that you bind the Categories collection property on your XamDiagramToolbox. This property accepts a DiagramToolboxCategoryCollection that you can populate with your own DiagramToolboxCategory items. This collection is clearable, and if you wish to just clear out the built-in shapes, you can invoke the Clear() method on your XamDiagramToolbox.Categories collection.

    Each of these DiagramToolboxCategory items has an Items collection in which you can place your shapes (DiagramToolboxItems) and assign each their Content property for what they should display from your ViewModel. If you add these shapes to your corresponding DiagramToolboxCategory, and add the DiagramToolboxCategory to your DiagramToolboxCategoryCollection, you can essentially bind your own custom shape collection for the XamDiagramToolbox, which will overwrite the old collection of shapes.

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

    Sincerely,
    Andrew
    Associate Developer