Skip to content

Commit ae6224c

Browse files
977115: ShowToolTip
1 parent 095e3b9 commit ae6224c

File tree

1 file changed

+16
-23
lines changed
  • UG-Samples/SymbolPalette/ShowToolTip/ShowToolTip/Pages

1 file changed

+16
-23
lines changed

UG-Samples/SymbolPalette/ShowToolTip/ShowToolTip/Pages/Index.razor

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
</SfCheckBox>
1313
</div>
1414
<div id="palette-space" class="sb-mobile-palette" style="border: 2px solid #b200ff">
15-
<SfSymbolPaletteComponent @ref="symbolPalette" Height="1000px" Width="300px"GetSymbolInfo="GetSymbolInfo"
16-
Palettes="Palettes" SymbolHeight="60" SymbolWidth="60"
17-
SymbolMargin="symbolMargin">
15+
<SfSymbolPaletteComponent @ref="symbolPalette" Height="1000px" Width="300px" GetSymbolInfo="GetSymbolInfo" Palettes="Palettes" SymbolHeight="60"
16+
SymbolWidth="60" SymbolMargin="symbolMargin">
1817
</SfSymbolPaletteComponent>
1918
</div>
2019
</div>
@@ -24,11 +23,11 @@
2423
</div>
2524

2625
@code {
27-
// Controls tooltip visibility for symbols at runtime
26+
// Controls tooltip visibility for symbols at runtime.
2827
private bool ShowTooltip = false;
2928
private SfSymbolPaletteComponent? symbolPalette;
3029
private SfDiagramComponent? diagram;
31-
private SymbolMargin symbolMargin = new SymbolMargin
30+
private SymbolMargin symbolMargin = new SymbolMargin()
3231
{
3332
Left = 15,
3433
Right = 15,
@@ -43,47 +42,47 @@
4342

4443
protected override void OnInitialized()
4544
{
46-
// Initialize all palette models with predefined shapes
45+
// Initialize all palette models with predefined shapes.
4746
InitPaletteModel();
4847
}
4948

5049
protected override async Task OnAfterRenderAsync(bool firstRender)
5150
{
5251
if (firstRender && symbolPalette != null && diagram != null)
5352
{
54-
// Set diagram as drag-drop target for symbol palette
53+
// Set diagram as drag-drop target for symbol palette.
5554
symbolPalette.Targets = new DiagramObjectCollection<SfDiagramComponent> { diagram };
5655
}
5756
}
5857

59-
// Configures symbol tooltip display based on checkbox state
58+
// Configures symbol tooltip display based on checkbox state.
6059
private SymbolInfo GetSymbolInfo(IDiagramObject symbol)
6160
{
62-
// Enable/disable tooltip display based on user preference at runtime
61+
// Enable/disable tooltip display based on user preference at runtime.
6362
return new SymbolInfo { ShowTooltip = ShowTooltip };
6463
}
6564

6665
private void InitPaletteModel()
6766
{
68-
// Add flow shapes to palette
67+
// Add flow shapes to palette.
6968
AddFlowShape(NodeFlowShapes.Terminator, "Terminator", 0);
7069
AddFlowShape(NodeFlowShapes.Decision, "Decision", 1);
7170
AddFlowShape(NodeFlowShapes.Process, "Process", 2);
7271
AddFlowShape(NodeFlowShapes.Document, "Document", 3);
7372

74-
// Add basic shapes to palette
73+
// Add basic shapes to palette.
7574
AddBasicShape(NodeBasicShapes.Rectangle, "Rectangle", 0);
7675
AddBasicShape(NodeBasicShapes.Ellipse, "Ellipse", 1);
7776
AddBasicShape(NodeBasicShapes.Pentagon, "Pentagon", 2);
7877
AddBasicShape(NodeBasicShapes.Hexagon, "Hexagon", 3);
7978

80-
// Add connectors to palette
79+
// Add connectors to palette.
8180
AddConnector("Orthogonal", ConnectorSegmentType.Orthogonal, DecoratorShape.Arrow, 0);
8281
AddConnector("Straight", ConnectorSegmentType.Straight, DecoratorShape.Arrow, 1);
8382
AddConnector("Bezier", ConnectorSegmentType.Bezier, DecoratorShape.Arrow, 2);
8483
AddConnector("StraightOpp", ConnectorSegmentType.Straight, DecoratorShape.None, 3);
8584

86-
// Create palette collection with all shape categories
85+
// Create palette collection with all shape categories.
8786
Palettes = new DiagramObjectCollection<Palette>
8887
{
8988
new Palette { Symbols = FlowShapesPalette, Title = "Flow Shapes", ID = "FlowShapes", IsExpanded = true },
@@ -103,8 +102,7 @@
103102
Style = new ShapeStyle { Fill = "#6495ED", StrokeColor = "#6495ED" },
104103
Constraints = NodeConstraints.Default | NodeConstraints.Tooltip
105104
};
106-
107-
// Add tooltip for even-indexed shapes only
105+
// Add tooltip for even-indexed shapes only.
108106
if (index % 2 == 0)
109107
{
110108
node.Tooltip = new DiagramTooltip
@@ -113,8 +111,7 @@
113111
ShowTipPointer = true,
114112
Position = Position.RightCenter
115113
};
116-
}
117-
114+
}
118115
FlowShapesPalette.Add(node);
119116
}
120117

@@ -134,8 +131,7 @@
134131
Style = new ShapeStyle { Fill = "#9CCC65", StrokeColor = "#558B2F" },
135132
Constraints = NodeConstraints.Default | NodeConstraints.Tooltip
136133
};
137-
138-
// Add tooltip for even-indexed shapes only
134+
// Add tooltip for even-indexed shapes only.
139135
if (index % 2 == 0)
140136
{
141137
node.Tooltip = new DiagramTooltip
@@ -145,7 +141,6 @@
145141
Position = Position.RightCenter
146142
};
147143
}
148-
149144
BasicShapesPalette.Add(node);
150145
}
151146

@@ -165,8 +160,7 @@
165160
},
166161
Constraints = ConnectorConstraints.Default | ConnectorConstraints.Tooltip
167162
};
168-
169-
// Add tooltip for even-indexed connectors only
163+
// Add tooltip for even-indexed connectors only.
170164
if (index % 2 == 0)
171165
{
172166
connector.Tooltip = new DiagramTooltip
@@ -176,7 +170,6 @@
176170
ShowTipPointer = true
177171
};
178172
}
179-
180173
ConnectorsPalette.Add(connector);
181174
}
182175
}

0 commit comments

Comments
 (0)