Skip to content

Commit 6fb4606

Browse files
ES-975464 - Addressed the concerns
1 parent 922d6b0 commit 6fb4606

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WPF-GridControl-ToolTip
1+
# WPF GridControl ToolTip
22

33
This repository contains the sample which shows add or remove the tooltip to a specific cell or row or column in [WPF GridControl](https://help.syncfusion.com/wpf/gridcontrol/overview).
44

@@ -16,6 +16,8 @@ gridcontrol.Model.ColStyles[1].ToolTip = "First column";
1616
gridcontrol.Model.ColStyles[1].ShowTooltip = true;
1717
```
1818

19+
![Showing ToolTip for row and column](ToolTipForRowAndColumn.png)
20+
1921
### Set ToolTip in QueryCellInfo event
2022

2123
You can set the ToolTip to a specific cell or row or column by using the [QueryCellInfo](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridControlBase.html#Syncfusion_Windows_Controls_Grid_GridControlBase_QueryCellInfo) event.
@@ -36,6 +38,8 @@ private void Gridcontrol_QueryCellInfo(object sender, GridQueryCellInfoEventArgs
3638
}
3739
```
3840

41+
![Showing ToolTip using QueryCellInfo](ToolTipUsingQueryCellInfo.png)
42+
3943
### Hide ToolTip for disabled cell
4044

4145
You can disable the cell by setting `Enabled` property to `false`. If you want to hide the tooltip for this disabled cell, you need to set the [ShowToolTip](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridStyleInfo_ShowTooltip) property to `false`.
@@ -59,11 +63,13 @@ private void Gridcontrol_QueryCellInfo(object sender, GridQueryCellInfoEventArgs
5963

6064
### Customize the ToolTip
6165

62-
The tooltip appearance can be customized by defining DataTemplate. The DataTemplate can be assigned to the GridStyleInfo.ToolTipTemplateKey or GridStyleInfo.ToolTipTemplate property. If you are using tooltipTemplate1 then you need to assign template to its corresponding template key property namely GridStyleInfo.ToolTipTemplate or GridStyleInfo.ToolTipTemplateKey.
66+
The tooltip appearance can be customized by defining DataTemplate. The DataTemplate can be assigned to the [GridStyleInfo.ToolTipTemplateKey](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridStyleInfo_TooltipTemplateKey) or [GridStyleInfo.ToolTipTemplate](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridStyleInfo_TooltipTemplate) property. If you are using tooltipTemplate1 then you need to assign template to its corresponding template key property namely GridStyleInfo.ToolTipTemplate or GridStyleInfo.ToolTipTemplateKey.
6367

64-
GridStyleInfo which holds cell information is the DataContext for data template of ToolTip.
68+
[GridStyleInfo](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridStyleInfo.html) which holds cell information is the DataContext for data template of ToolTip.
69+
70+
#### Using ToolTipTemplateKey
6571

66-
#### XAML
72+
##### XAML
6773

6874
``` xml
6975
<Window.Resources>
@@ -79,7 +85,7 @@ GridStyleInfo which holds cell information is the DataContext for data template
7985
</Window.Resources>
8086
```
8187

82-
#### Using ToolTipTemplateKey
88+
##### C#
8389

8490
``` csharp
8591
//Set the template key to a particular index
@@ -98,6 +104,24 @@ private void Gridcontrol_QueryCellInfo(object sender, GridQueryCellInfoEventArgs
98104

99105
#### Using ToolTipTemplate
100106

107+
##### XAML
108+
109+
``` xml
110+
<Window.Resources>
111+
<DataTemplate x:Key="tooltipTemplate1">
112+
<Border Name="Border"
113+
Background="Green"
114+
BorderBrush="Black"
115+
BorderThickness="1" Width="60" Height="20"
116+
CornerRadius="0">
117+
<TextBlock Background="Transparent" Text="{Binding Path=ToolTip}" Padding="2" />
118+
</Border>
119+
</DataTemplate>
120+
</Window.Resources>
121+
```
122+
123+
##### C#
124+
101125
``` csharp
102126
//Set the template key to a particular index
103127
gridcontrol.Model[1, 1].TooltipTemplate = (DataTemplate)this.Resources["tooltipTemplate1"];
@@ -113,4 +137,12 @@ private void Gridcontrol_QueryCellInfo(object sender, GridQueryCellInfoEventArgs
113137
}
114138
```
115139

116-
![alt text](Customize_the_ToolTip.png)
140+
![Customizing ToolTip using ToolTipTemplate](Customize_the_ToolTip.png)
141+
142+
### Remove the ToolTip
143+
144+
The `ResetValue` method is used to remove the ToolTip for any cell or row or column in GridControl and to reset the ToolTip value to the default values.
145+
146+
``` csharp
147+
gridcontrol.Model[1, 1].ResetValue(GridStyleInfoStore.ToolTipProperty);
148+
```

ToolTipForRowAndColumn.png

30.9 KB
Loading

ToolTipUsingQueryCellInfo.png

31.1 KB
Loading

0 commit comments

Comments
 (0)