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.
Unfortunately, activation email could not send to your email. Please try again.

How can I change the backColor of the Captions(GroupedRowHeaders) of the GridGroupingControl after grouping when I click on them with SHIFT key - to select several captions.

Thread ID:

Created:

Updated:

Platform:

Replies:

51731 Nov 13,2006 06:26 AM Nov 14,2006 05:06 AM Windows Forms 3
loading
Tags: GridControl
Alexander
Asked On November 13, 2006 06:26 AM

Hello,

How can I change the color of the Captions(GroupedRowHeaders) of the GridGroupingControl after grouping when I click on them with SHIFT key - to select several captions.
And this captions is not expanded and the event TableControlCellClick raises only for first Caption and for the last caption from selected group when I click on it with SHIFT key!!!

So if we have such captions

A1
A2
A3
A4
A5

and I select (click) A1 and with SHIFT key click(select) A4 - so the event is raising TableControlCellClick only for A1 and A4 caption clicks!!!

The event SelectedRecordsChanged cant help me!!!

I know how to chage backColor - I have a handler:
private void clientGridControl_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
//if (clientGridControl.TableControl != null)
//{
// if (e.TableCellIdentity.RowIndex == 4 && e.TableCellIdentity.ColIndex == 2)
// {
// //GridTableCellStyleInfo style = clientGridControl.TableControl.Model[4, 2];
// //Element el = style.TableCellIdentity.DisplayElement;

// if (e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Caption)
// {
// e.Style.Themed = false;
// e.Style.BackColor = Color.Yellow;
// }
// }
//}

bool flagChanged = false;
if (e.TableCellIdentity != null &&
e.TableCellIdentity.DisplayElement != null &&
e.TableCellIdentity.DisplayElement.ParentGroup != null &&
e.TableCellIdentity.DisplayElement.ParentGroup.Category != null)
{
if (e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Caption &&
e.Style.Text != "")
{
if (flagChanged == false)
{
if (_dicElementGridCaptions_Clicked.Count > 0)
{
//if (_dicElementGridCaptions_Clicked.ContainsValue(e.TableCellIdentity.DisplayElement) == true)
if (_dicElementGridCaptions_Clicked.ContainsKey(e.TableCellIdentity.DisplayElement.ParentGroup.Category.ToString()) == true)
{
e.Style.Themed = false;
e.Style.BackColor = Color.SkyBlue;
flagChanged = true;
}
else
{
e.Style.BackColor = System.Drawing.SystemColors.Control;
}
}
else
{
e.Style.BackColor = System.Drawing.SystemColors.Control;
}
}
}
}
}
Best regards, Alexander.


Administrator [Syncfusion]
Replied On November 13, 2006 07:48 AM

Hi Alexander ,

Please refer to the below forum threads for changing CaptionCell Backcolor.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=31249
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=31325

Best Regards,
Haneef

Alexander
Replied On November 13, 2006 08:03 AM


Thanks, but this links didn't help me!!!!
I said that I know how to change the color and in my application it work good even if we click on the captions with Ctrl button -> but I need to select the group of the captions with SHIFT key!!!

*** How I can get a collection of selected Captions(not expanded) with SHIFT key!!!! ***

Administrator [Syncfusion]
Replied On November 14, 2006 05:06 AM

Hi Alexander,

Try setting the TableOptions.AllowSelection property to GridSelectionFlags.Any and set the add the selected range using TableModel.Selections.Add method. Please refer to the attached sample for implementation and let us know if you are looking something different.

this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.None;
this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;

//Add the Selection from 4th row to 8th row in a grid
this.gridGroupingControl1.TableModel.Selections.Add(GridRangeInfo.Rows(4,8));

Sample :http://www.syncfusion.com/Support/user/uploads/GroupCaptionAndSelection_a2b60037.zip

Best Regards,
Haneef

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.

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.

;