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. Image for the cookie policy date

Inserting text into a SymbolPaletteItem

This is related to my other question. How do I insert text inside a symbol palette item in the symbol palette toolbox on the side? I am generating the items in that palette programmatically and I want to have a caption on each to label each diagram shape as to what it is.

1 Reply

JR Jegan R Syncfusion Team June 21, 2010 07:10 PM UTC

Hi Michael,

Thanks for your interest in Syncfusion products.

Regarding adding text inside symbol palette item, Symbol palette items can contain any UIElement as its content, provided they must be serializable. A sample has been created please refer the sample form the following link.

Sample Link: http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=DiagramSample162235718.zip

To add a text in Symbol palette item, please create a grid and add the required content as its children, along with it create a TextBlock with the required text and added it into Grid’s Children. Now assign this Grid as SymbolPaletteItems Content as shown in the following Code Snippet.

Code Snippet:

//new Symbol palette item
SymbolPaletteItem symbolPaletteItem = new SymbolPaletteItem();
//Content for SymbolPaletteItem
System.Windows.Shapes.Path path = this.Resources["CustomShape"] as System.Windows.Shapes.Path;
Grid g = new Grid();
//Text content for SymbolPaletteITem
TextBlock test = new TextBlock() { Text = "Text", HorizontalAlignment=HorizontalAlignment.Center,VerticalAlignment=VerticalAlignment.Center};
//Add both the contents as grid's children
g.Children.Add(path);
g.Children.Add(test);
//Assign the grid as the SymbolPaletteItems' content.
symbolPaletteItem.Content = g;


Please let us know if there are any concerns.

Regards,
Jegan

Loader.
Live Chat Icon For mobile
Up arrow icon