From de335545ab6eeb48b5ac19c546cea8cdf9bebb01 Mon Sep 17 00:00:00 2001 From: sandhiyanatesh <166396785+sandhiyanatesh@users.noreply.github.com> Date: Fri, 8 Aug 2025 13:18:55 +0530 Subject: [PATCH] 973592: Disable default tooltip for symbols in palette --- .../defaulttooltip/description.cs | 37 ++++++++++++++ .../symbol-palette/defaulttooltip/tagHelper | 2 + ej2-asp-core-mvc/diagram/symbol-palette.md | 49 +++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 ej2-asp-core-mvc/code-snippet/diagram/symbol-palette/defaulttooltip/description.cs create mode 100644 ej2-asp-core-mvc/code-snippet/diagram/symbol-palette/defaulttooltip/tagHelper diff --git a/ej2-asp-core-mvc/code-snippet/diagram/symbol-palette/defaulttooltip/description.cs b/ej2-asp-core-mvc/code-snippet/diagram/symbol-palette/defaulttooltip/description.cs new file mode 100644 index 0000000000..937fbdf7fe --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/diagram/symbol-palette/defaulttooltip/description.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using Syncfusion.EJ2.Diagrams; +using System.Drawing; + +namespace EJ2MVCSampleBrowser.Controllers.Diagram +{ + public partial class DiagramController : Controller + { + // GET: Nodes + public ActionResult Nodes() + { + List SymbolPaletee = new List(); + List BasicNodes = new List(); + BasicNodes.Add(new DiagramNode() + { + Id = "rectangle", + Shape = new DiagramBasicShape() { Type = Syncfusion.EJ2.Diagrams.Shapes.Basic, Shape = BasicShapes.Rectangle }, + //To display customized tooltip content by enabling Tooltip Constraints + Tooltip = new DiagramDiagramTooltip() { Content = "custom tooltip content" }, + Constraints = NodeConstraints.Default | NodeConstraints.Tooltip + }); + BasicNodes.Add(new DiagramNode() { Id = "plus", Shape = new DiagramBasicShape() { Type = Syncfusion.EJ2.Diagrams.Shapes.Basic, Shape = BasicShapes.Plus } }); + BasicNodes.Add(new DiagramNode() { Id = "triangle", Shape = new DiagramBasicShape() { Type = Syncfusion.EJ2.Diagrams.Shapes.Basic, Shape = BasicShapes.RightTriangle } }); + ViewBag.BasicShapes = BasicNodes; + + List palettes = new List(); + palettes.Add(new SymbolPalettePalette() { Id = "basic", Expanded = true, Symbols = BasicNodes, Title = "Basic Shapes" }); + ViewBag.palettes = palettes; + ViewBag.getSymbolInfo = "getSymbolInfo"; + return View(); + } + } +} \ No newline at end of file diff --git a/ej2-asp-core-mvc/code-snippet/diagram/symbol-palette/defaulttooltip/tagHelper b/ej2-asp-core-mvc/code-snippet/diagram/symbol-palette/defaulttooltip/tagHelper new file mode 100644 index 0000000000..838842cf78 --- /dev/null +++ b/ej2-asp-core-mvc/code-snippet/diagram/symbol-palette/defaulttooltip/tagHelper @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ej2-asp-core-mvc/diagram/symbol-palette.md b/ej2-asp-core-mvc/diagram/symbol-palette.md index b5ddc39898..d2d873d06e 100644 --- a/ej2-asp-core-mvc/diagram/symbol-palette.md +++ b/ej2-asp-core-mvc/diagram/symbol-palette.md @@ -409,6 +409,55 @@ Here, the code provided below demonstrates how to define tooltip content to symb {% endtabs %} {% endif %} +### How to enable or disable the default tooltip for shapes in the Symbol Palette + +The `showIdAsTooltip` property lets you control whether the default tooltip appears for symbols in the Symbol Palette. Set this property to false to disable the default tooltip, or to true to enable it. If showIdAsTooltip is not explicitly set, the default tooltip will be displayed. +To control tooltip behavior for each symbol, use the `getSymbolInfo` property. This allows you to selectively enable or disable tooltips for specific symbols within the palette, providing flexibility in how tooltips are presented. + +The following code example demonstrates how to enable or disable the default tooltip for shapes in the Symbol Palette. + +{% if page.publishingplatform == "aspnet-core" %} + +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} +{% include code-snippet/diagram/symbol-palette/defaulttooltip/tagHelper %} +{% endhighlight %} +{% highlight c# tabtitle="Description.cs" %} +{% include code-snippet/diagram/symbol-palette/defaulttooltip/description.cs %} +{% endhighlight %} +{% endtabs %} + +{% elsif page.publishingplatform == "aspnet-mvc" %} + +{% tabs %} +{% highlight c# tabtitle="Description.cs" %} +{% include code-snippet/diagram/symbol-palette/defaulttooltip/description.cs %} +{% endhighlight %} +{% endtabs %} +{% endif %} + +```javascript + + function getSymbolInfo(symbol) { + //custom tooltip will be shown for the rectangle shape + if (symbol.id === 'rectangle') { + return { showIdAsTooltip: true}; + } + //default tooltip will be shown for the plus shapes + if(symbol.id === 'plus') { + return { showIdAsTooltip: true }; + } + //default tooltip will not be shown for the triangle shape + if (symbol.id === 'triangle') { + return { showIdAsTooltip: false }; + } + return { width: 50, height: 50 }; +} + +``` + +N> This property is effective only when tooltip constraints are disabled for the symbol palette element. + ### How to provide different tooltip for Symbol palette and diagram elements.