GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SyncfusionExamples/wpf-gridcontrol-coveredcells: This repository contains the samples that demonstrates various options in covered cell feature of wpf gridcontrol.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
AfterExtendingCoveredRange.png
AfterExtendingCoveredRange.png
 
 
AfterRemovingCoveredRange.png
AfterRemovingCoveredRange.png
 
 
BeforeExtendingCoveredRange.png
BeforeExtendingCoveredRange.png
 
 
BeforeRemovingCoveredRange.png
BeforeRemovingCoveredRange.png
 
 
CoveredCellsUsingQueryCoveredRange.png
CoveredCellsUsingQueryCoveredRange.png
 
 
FindingCellinCoveredRange.png
FindingCellinCoveredRange.png
 
 
README.md
README.md
 
 

Repository files navigation

WPF GridControl CoveredCells

This repository contains the samples that demonstrates various options in covered cell feature of WPF GridControl.

Creating covered cells using QueryCoveredRange event

You can also covered the range of cells by using QueryCoveredRange event. This event will be raised for all the cells and you can set the range of cells by using Range property.

//Triggering the QueryCoveredRange event
grid.QueryCoveredRange += Grid_QueryCoveredRange;

private void Grid_QueryCoveredRange(object sender, Syncfusion.Windows.Controls.Grid.GridQueryCoveredRangeEventArgs e)
{
    //Checking the cell to start covered range.
    if(e.CellRowColumnIndex.RowIndex == 2 && e.CellRowColumnIndex.ColumnIndex == 2)
    {
        //Set the range to be covered.
        e.Range = new CoveredCellInfo(2, 2, 5, 5);

        //Handled property has to be enabled to perform this customization.
        e.Handled = true;
    }
}

GridControl with covered cells applied using QueryCoveredRange event

Find whether a cell in covered range

When you want to find a cell in covered ranges, you can use the GetCoveredCell method. If the specified cell with row index and column index is inside in GetCoveredCell, a range will be returned.

// Adding covered ranges
grid.Model.CoveredRanges.Add(new CoveredCellInfo(2, 2, 5, 5));

//Find the covered ranges
CoveredCellInfo coverRanges = grid.Model.CoveredRanges.GetCoveredCell(2, 3);
MessageBox.Show("Cover range for cell (2,3) is " + "R" + coverRanges.Left + "C" + coverRanges.Top + ":" + "R" + coverRanges.Bottom + "C" + coverRanges.Right);

Image showing cell which is in covered range

Remove covered range at run time

You can remove the covered range at run time by using Clear method.

//Removing the covered range from GridControl.
grid.Model.CoveredRanges.Clear();

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.

XAML

<Grid>
    <syncfusion:GridControl Name="grid" Margin="10,20,0,0" />
    <Button Height="50" Width="100" Margin="400,200,0,0" Click="Button_Click" />
</Grid>

C#

grid.Model.CoveredRanges.Add(new CoveredCellInfo(2, 2, 5, 5));
private void Button_Click(object sender, RoutedEventArgs e)
{
    grid.Model.CoveredRanges.Clear();
    grid.InvalidateCells();
}

The below image provides covered range at run time before removing

Gridcontrol before removing the covered range

The below image provides covered range at run time after removing

Gridcontrol after removing the covered range

Extend covered range at run time

You can extend the covered range at run time by using Add method.

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.

Note: Before extend the covered cell range, you need to clear the covered range.

//Remove the current covered cell range
grid.Model.CoveredRanges.Clear();
grid.InvalidateCells();
//Add new covered cell range
grid.Model.CoveredRanges.Add(new CoveredCellInfo(2, 2, 7, 7));

The below image provides covered range at run time before extending.

Gridcontrol with covered range before extending

The below image provides covered range at run time after extending.

Gridcontrol with convered range after extending

About

This repository contains the samples that demonstrates various options in covered cell feature of wpf gridcontrol.

Topics

coveredcellsextendcoveredcellgridcontrolmerge-cellremoverangewpf

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

4 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.