Hello, I'm trying to change the focused cell on a ultra grid to have a different back color. The following code works if I turn off appstyling
Private Sub ProductiveGrid_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles Me.InitializeLayout ' Allow sorting in the grid. 'e.Layout.Override.HeaderClickAction = HeaderClickAction.SortSingle ' Apply an ActiveCellAppearance and ActiveRowAppearance ' to make the search results easier to see. If (Not e.Layout.Appearances.Exists("ActiveCell")) Then Dim activeCellAppearance As Infragistics.Win.Appearance = e.Layout.Appearances.Add("ActiveCell") activeCellAppearance.BackColor2 = Color.Yellow activeCellAppearance.BackGradientStyle = 2 ' GradientStyle.Vertical End If e.Layout.Override.ActiveCellAppearance = e.Layout.Appearances("ActiveCell") If (Not e.Layout.Appearances.Exists("ActiveRow")) Then Dim activeRowAppearance As Infragistics.Win.Appearance = e.Layout.Appearances.Add("ActiveRow") activeRowAppearance.BackColor2 = Color.Goldenrod activeRowAppearance.BackGradientStyle = 2 ' GradientStyle.Vertical End If e.Layout.Override.ActiveRowAppearance = e.Layout.Appearances("ActiveRow") End Sub
how do I do this in the appstyle designer?
that worked! Thanks for your help.
Hi,
There are a couple of problems here.
First, the Isl file you are using here has no settings for the Active state of the GridCell.
Second, it looks like the Active state of the row has a resource applied to it and the resource is using an Image applied to it. So the image is going to cover the entire row. So you probably need to remove the image on the GridRow's Active state - either by removing the resource from this state or removing the image from the resource.
The attached example shows what I am trying to do. The source code is from the infragistics site with minor changes. If you run the app it will ask you if you want to use app style, say no a grid of random values will open, if you set the focus on the grid and start to type the grid will "find" what you are typing and highlight it. If you stop the project and re-open and say yes to run app style you will see the highlight does not work. I'm sure the problem is something simple, it's just a matter of figuring out what to set int he app style designer.
Thanks!
It's hard to say since I can't see what you did. But I'm a little concerned by your use of the word "Selected" here. Selected and Active are not the same thing and it's important to understand the difference.
Also, you probably can't use a gradient for the Active cell. When a cell goes into edit mode, the grid will place a TextBox over that cell, and the TextBox does not support gradients. So you can really only use a gradient if the cell is not editable. It shoulds still pick up the BackColor when in edit mode, though.
Thanks for the response, still having problems.
Made the changes as you suggested however this did not work the same as when the appstyle is turned off. I selected GridCell per your suggestion and changed to the active tab, then changed to gradient and selected my two colors. In the designer the background of the selected sell was not gradient and the interface didn't act as expected. I saved the .isl file and tried it anyway, there was no change. What am I doing wrong?