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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Background Virtual Grid

Thread ID:





82108 Jun 2,2009 12:59 PM UTC Jun 2,2009 03:45 PM UTC WPF 1
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)
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.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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