Skip to content

Commit 53c1ef1

Browse files
ES-975464 - Addressed the concerns
1 parent 0671bc7 commit 53c1ef1

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

CommentTipForRowAndColumn1.png

8.13 KB
Loading

CommentTipForRowAndColumn2.png

8.59 KB
Loading

CommentTipUsingQueryCellInfo.png

8.65 KB
Loading

CommentTipWithPositionChanged.png

8.84 KB
Loading

CustomizedCommentTip.png

9.18 KB
Loading

README.md

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

3-
This repository contains the sample which shows the comment tip to a specific cell or row or column in [WPF GridControl](https://help.syncfusion.com/wpf/gridcontrol/overview).
3+
This repository contains the sample which shows the comment tip to a specific cell or row or column in [WPF GridControl](https://www.syncfusion.com/wpf-controls/excel-like-grid).
44

55
### Comment Tip for row and column
66

@@ -13,6 +13,28 @@ grid.Model.RowStyles[1].Comment = "Hello";
1313
grid.Model.ColStyles[2].Comment = "Hello";
1414
```
1515

16+
![Showing comment tip for row and column](CommentTipForRowAndColumn1.png)
17+
18+
An another way to set the comment tip for specific row and column,
19+
20+
``` csharp
21+
//Add CommentTip for specific row
22+
for (int i = 1; i <= 4; i++)
23+
{
24+
string comment = grid.Model[1, 0].CellValue + " :\nPopulate rate in " + grid.Model[1, i].ColumnIndex + " is " + grid.Model[1, i].CellValue;
25+
grid.Model[1, i].Comment = comment;
26+
}
27+
28+
//Add CommentTip for specific column
29+
for (int i = 1; i < 4; i++)
30+
{
31+
string comment = grid.Model[i, 0].CellValue + " :\nPopulate rate in " + grid.Model[i, 2].RowIndex + " is " + grid.Model[i, 2].CellValue;
32+
grid.Model[i, 2].Comment = comment;
33+
}
34+
```
35+
36+
![Showing comment tip for row and column](CommentTipForRowAndColumn2.png)
37+
1638
### Change comment indicator position
1739

1840
Setting `Comment` property always displays comment indicator at top right corner of the cell. You can change the comment indicator position for a specific cell by using [GridCommentStyleInfo](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html). For example, you can set the comment indicator at top position for any cell by setting [GridCommentStyleInfo.TopLeftComment](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_TopLeftComment) or [GridCommentStyleInfo.TopRightComment](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_TopRightComment) properties.
@@ -47,6 +69,8 @@ for (int i = 1; i < 4; i++)
4769
}
4870
```
4971

72+
![Comment tip with modified indicator position](CommentTipWithPositionChanged.png)
73+
5074
### Set CommentTip using QueryCellInfo
5175

5276
You can set the comment tip to a specific cell or row or column by using [QueryCellInfo](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridModel.html#Syncfusion_Windows_Controls_Grid_GridModel_QueryCellInfo) event.
@@ -79,11 +103,13 @@ private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
79103
}
80104
```
81105

106+
![Showing comment tip using QueryCellInfo](CommentTipUsingQueryCellInfo.png)
107+
82108
### Customize the CommentTip
83109

84110
The comment tip appearance can be customized by defining DataTemplate. The DataTemplate can be assigned to [GridStyleInfo.CommentTemplateKey](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridStyleInfo_CommentTemplateKey). If you are using [TopLeftComment](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_TopLeftComment), [TopRightComment](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_TopRightComment), [BottomRightComment](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_BottomRightComment), or [BottomLeftComment](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_BottomLeftComment) then you need to assign template to its corresponding template key property namely [GridCommentStyleInfo.TopLeftCommentTemplateKey](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_TopLeftCommentTemplateKey), [GridCommentStyleInfo.TopRightCommentTemplateKey](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_TopRightCommentTemplateKey), [GridCommentStyleInfo.BottomLeftCommentTemplateKey](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_BottomLeftCommentTemplateKey) or [GridCommentStyleInfo.BottomRightCommentTemplateKey](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCommentStyleInfo.html#Syncfusion_Windows_Controls_Grid_GridCommentStyleInfo_BottomRightCommentTemplateKey).
85111

86-
GridStyleInfo which holds cell information is the DataContext for data template of comment.
112+
[GridStyleInfo](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridStyleInfo.html) which holds cell information is the `DataContext` for data template of comment.
87113

88114
In the below code TopLeft comment is customized.
89115

@@ -116,4 +142,4 @@ grid.Model[1, 2].GridCommentStyleInfo.TopLeftCommentTemplateKey = "TopLeftCommen
116142
}
117143
```
118144

119-
![alt text](Customize_the_CommentTip.png)
145+
![Showing customized Comment Tip](CustomizedCommentTip.png)

0 commit comments

Comments
 (0)