Skip to content

Commit 21479b7

Browse files
ES-975464 - Resolve the ReadMe file length issue in this sample repository
1 parent 5413b5b commit 21479b7

File tree

1 file changed

+81
-2
lines changed

1 file changed

+81
-2
lines changed

README.md

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,81 @@
1-
# wpf-gridcontrol-coveredcells
2-
This repository contains the samples that demonstrates various options in covered cell feature of wpf gridcontrol.
1+
# WPF GridControl coveredcells
2+
3+
This repository contains the samples that demonstrates various options in covered cell feature of [WPF GridControl](https://help.syncfusion.com/wpf/gridcontrol/overview).
4+
5+
### Creating covered cells using QueryCoveredRange event
6+
7+
You can also covered the range of cells by using [QueryCoveredRange](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridControlBase.html#Syncfusion_Windows_Controls_Grid_GridControlBase_QueryCoveredRange) event. This event will be raised for all the cells and you can set the range of cells by using [Range](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridQueryCoveredRangeEventArgs.html#Syncfusion_Windows_Controls_Grid_GridQueryCoveredRangeEventArgs_Range) property.
8+
9+
``` csharp
10+
//Triggering the QueryCoveredRange event
11+
grid.QueryCoveredRange += Grid_QueryCoveredRange;
12+
13+
private void Grid_QueryCoveredRange(object sender, Syncfusion.Windows.Controls.Grid.GridQueryCoveredRangeEventArgs e)
14+
{
15+
//Checking the cell to start covered range.
16+
if(e.CellRowColumnIndex.RowIndex == 2 && e.CellRowColumnIndex.ColumnIndex == 2)
17+
{
18+
//Set the range to be covered.
19+
e.Range = new CoveredCellInfo(2, 2, 5, 5);
20+
21+
//Handled property has to be enabled to perform this customization.
22+
e.Handled = true;
23+
}
24+
}
25+
```
26+
27+
### Find whether a cell in covered range
28+
29+
When you want to find a cell in covered ranges, you can use the [GetCoveredCell](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.Grid.GridCoveredCellInfoCollection.html#Syncfusion_Windows_Controls_Grid_GridCoveredCellInfoCollection_GetCoveredCell_System_Int32_System_Int32_) method. If the specified cell with row index and column index is inside in `GetCoveredCell`, a range will be returned.
30+
31+
``` csharp
32+
// Adding covered ranges
33+
grid.Model.CoveredRanges.Add(new CoveredCellInfo(2, 2, 5, 5));
34+
35+
//Find the covered ranges
36+
CoveredCellInfo coverRanges = grid.Model.CoveredRanges.GetCoveredCell(2, 3);
37+
MessageBox.Show("Cover range for cell (2,3) is " + "R" + coverRanges.Left + "C" + coverRanges.Top + ":" + "R" + coverRanges.Bottom + "C" + coverRanges.Right);
38+
```
39+
40+
### Remove covered range at run time
41+
42+
You can remove the covered range at run time by using [Clear](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.CellGrid.CellSpanInfoCollection-1.html#Syncfusion_UI_Xaml_CellGrid_CellSpanInfoCollection_1_Clear) method.
43+
44+
``` csharp
45+
//Removing the covered range from GridControl.
46+
grid.Model.CoveredRanges.Clear();
47+
```
48+
49+
For example, If you want to remove the covered range at run time, create one button and set the Clear method for covered range in click event of button.
50+
51+
#### XAML
52+
``` xml
53+
<Grid>
54+
<syncfusion:GridControl Name="grid" Margin="10,20,0,0" />
55+
<Button Height="50" Width="100" Margin="400,200,0,0" Click="Button_Click" />
56+
</Grid>
57+
```
58+
59+
#### C#
60+
``` csharp
61+
grid.Model.CoveredRanges.Add(new CoveredCellInfo(2, 2, 5, 5));
62+
private void Button_Click(object sender, RoutedEventArgs e)
63+
{
64+
grid.Model.CoveredRanges.Clear();
65+
grid.InvalidateCells();
66+
}
67+
```
68+
69+
### Extend covered range at run time
70+
71+
You can extend the covered range at run time by using [Add](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.CellGrid.CellSpanInfoCollection-1.html#Syncfusion_UI_Xaml_CellGrid_CellSpanInfoCollection_1_Add__0_) method.
72+
73+
For example, Create one button. Next, clear the current covered cell collection using `Clear` method and create new covered cell ranges by using `Add` method in this click event.
74+
75+
``` csharp
76+
//Remove the current covered cell range
77+
grid.Model.CoveredRanges.Clear();
78+
grid.InvalidateCells();
79+
//Add new covered cell range
80+
grid.Model.CoveredRanges.Add(new CoveredCellInfo(2, 2, 7, 7));
81+
```

0 commit comments

Comments
 (0)