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
305
Setting Icon for DiagramNode
posted

Hi, 

I would like to add an Icon to DiagramNode, I am adding custom category to toolbox, and then under that category I am adding Item which contains the Diagram Node, in this Node I would like to show the Icon, I also want that user should be able to Add the text to this Node(whatever default behaviour is now), I tried lots of permutaion and combination and finally I am ran out of ideas, can anyone please help.

Parents
  • 17475
    Offline posted

    Hello Manoj,

    Thank you for contacting Infragistics!

    The default template could be modified by creating templates that are set for the DisplayTemplate property. You may have a look at the following forum thread where Gergana shared a sample: http://es.infragistics.com/community/forums/t/93312.aspx.  In order to change the template for the toolbox you can set that in the custom category e.g.:
    <ig:DiagramToolboxCategory Name="Custom Shapes"
                                       IsExpanded="True">
                        <ig:DiagramToolboxCategory.Items>
                            <ig:DiagramToolboxItem Title="Custom">
                                <ig:DiagramToolboxItem.Item>                               
                                    <ig:DiagramNode Width="30" Height="30">
                                        <ig:DiagramNode.ConnectionPoints>
                                            <ig:DiagramConnectionPointCollection>
                                                <ig:DiagramConnectionPoint Name="Point" Position="0.5,0.5" />
                                            </ig:DiagramConnectionPointCollection>
                                        </ig:DiagramNode.ConnectionPoints>                                  
                                        <ig:DiagramNode.DisplayTemplate>
                                            <ItemContainerTemplate>
                                                <StackPanel Orientation="Horizontal">
                                                    <Image Source="Tools2.png" Height="50" Width="50"/>
                                                    <TextBox Text="Custom" Height="20"/>
                                                </StackPanel>
                                            </ItemContainerTemplate>
                                        </ig:DiagramNode.DisplayTemplate>                                  
                                    </ig:DiagramNode>
                                </ig:DiagramToolboxItem.Item>
                            </ig:DiagramToolboxItem>
                        </ig:DiagramToolboxCategory.Items>
                    </ig:DiagramToolboxCategory>
                </ig:XamDiagramToolbox.CustomCategories>

Reply Children