In my grid I have a column where I changed the default cursor. I do this in grd_InitializeLayout:
e.Layout.Bands(0).Columns("FileName").CellAppearance.Cursor = Cursors.Hand.
However, when the user is in an add row, I want to keep the default cursor, so I added the code:
e.Layout.Bands(0).Override.TemplateAddRowCellAppearance.Cursor = Cursors.Default
e.Layout.Bands(0).Override.AddRowCellAppearance.Cursor = Cursors.Default.
Unfortunately, when I move my mouse over the cell for that column in an add row, it is still showing the Hand cursor instead of the default cursor. How would I make sure the correct cursor is shown?
Hi,
I tested out your code and I also added a BackColor to each appearance just so I can see the order of precedence. It looks like the CellAppearance on the column overrides any appearances on the row level, so it's nothing specifically to do with the Cursor property.
So I think you will have to handle a few events and set the cursor on the cell level. Here's some sample code I whipped up that seems to work.
Imports Infragistics.Win.UltraWinGridPublic Class Form1 Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout Dim HandAppearance As Infragistics.Win.Appearance HandAppearance = e.Layout.Appearances.Add("Hand") HandAppearance.Cursor = Cursors.Hand e.Layout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom End Sub Private Sub UltraGrid1_InitializeRow(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles UltraGrid1.InitializeRow Me.SetHandCursor(e.Row) End Sub Private Sub UltraGrid1_InitializeTemplateAddRow(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeTemplateAddRowEventArgs) Handles UltraGrid1.InitializeTemplateAddRow Me.SetHandCursor(e.TemplateAddRow) End Sub Private Sub UltraGrid1_AfterRowUpdate(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.RowEventArgs) Handles UltraGrid1.AfterRowUpdate Me.SetHandCursor(e.Row) End Sub Private Sub SetHandCursor(ByVal row As UltraGridRow) If row.IsAddRow OrElse row.IsTemplateAddRow Or row.IsUnmodifiedTemplateAddRow Then row.Cells("Column 1").Appearance = Nothing Else row.Cells("Column 1").Appearance = row.Band.Layout.Appearances("Hand") End If End SubEnd Class