We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Background Virtual Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

82108 Jun 2,2009 12:59 PM UTC Jun 2,2009 03:45 PM UTC WPF 1
loading
Tags: GridControl
Andrew Snyder
Asked On June 2, 2009 12:59 PM UTC


I am trying to give the ability to change the background color of a cell on right click event. It seems to work fine if the cell is empty but once there is data in cell it does not change the background.

Sample Preview Mouse Down event

void SampleGridControl_MouseDown(object sender, MouseButtonEventArgs e)
{ RowColumnIndex _lastMouseDown = PointToCellRowColumnIndex(e);
if (e.RightButton == MouseButtonState.Pressed)
{
InvalidateCellBackground(_lastMouseDown);
Model[_lastMouseDown.RowIndex, _lastMouseDown.ColumnIndex].Background = Brushes.Crimson;
}
}

Administrator [Syncfusion]
Replied On June 2, 2009 03:45 PM UTC

If you are using a true virtual grid, then normally, you would try to avoid code like:

grid.Model[row, col].Background = Brushes.Crimson;


The reason is that in a virtual grid, there is no storage automatically allocated to store cell specific properties.

In general, for a virtual grid, you would have to provide the Crimson brush in QueryCellInfo. In the mousedown event, you would just want to make sure QueryCellInfo is hit. Attached is a little sample that does this.




WpfApplication13_bbc314bb.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;