Hi, how can I set the hottrackappearance for a cell when the cell has a Special value?
So, if the mouse goes over a row the whole row should have hottrack-backcolor blue and the cell with Special content should get red. Is this possible? I didn't find any properties for that:
I will set this in initialize-Row-Event. but e.row.cells(3). has only Appearance and SelectAppearance. Nothing with hottrack.....
? Any ideas? Thank you!
Hello BBK_JB,
I have been investigating into this issue, and in order to achieve your requirement, I would recommend that you continue with the InitializeRow event. In order to set the row hover, you can set the e.Row.Band.Override.HotTrackRowAppearance property, where e is the event arguments of the InitializeRow event. The code for this could look like the following:
private void Grid_InitializeRow(object sender, InitializeRowEventArgs e){ e.Row.Band.Override.HotTrackRowAppearance = new Infragistics.Win.Appearance() { BackColor = Color.Blue };}
This will set each of the rows blue when you hover over them. In order to target a specific cell, I would recommend utilizing two extra events: MouseEnterElement and MouseLeaveElement. When doing this, you can check the e.Element.GetContext method for an UltraGridRow type. From here, you can get into the Cells collection of that row and set its BackColor if the Value of that cell matches your condition. In the MouseLeaveElement event, you would set this cell's BackColor back to what it was previously. The code for this would look like following:
private void Grid_MouseLeaveElement(object sender, UIElementEventArgs e){ UltraGridRow row; row = (UltraGridRow)e.Element.GetContext(typeof(UltraGridRow));
if (row != null) { row.Cells["TrueFalse"].Appearance.BackColor = Color.White; }}
private void Grid_MouseEnterElement(object sender, UIElementEventArgs e){ UltraGridRow row; row = (UltraGridRow)e.Element.GetContext(typeof(UltraGridRow));
if(row != null) { if((bool)row.Cells["TrueFalse"].Value == false) { row.Cells["TrueFalse"].Appearance.BackColor = Color.Red; } }}
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer