I am trying to make the look and feel of grid selection to be excel-like.
So I want to switch off hot tracking. Using App Stylelist I have made appearance of all states of a row and hoot tracked cell to be the same as normal state. Only active and selected states are coloured in a highlight.
However the row still hot tracks.
Hi,
If the row is Hot Tracking, then something in the style or in the applicaiton is making it do so. The grid does not hot track rows by default, so there must either be a property that you explicitly turned on, or else it's some setting in the style library.
Thanks for that.
Switching off the style library does indeed stop hot tracking. I was using just one of the example templates styles which seems to bring on hot tracking and I couldn't work out how to stop it in the the App Style.
I also wanted the row selection to switch off i.e, just for a selected cell to be highlighted. I did this by editing the style library so that selected row appearance was the same as normal, unseleced row appearance which I think was a bit of a hack.
In fact, what I want is something that selects like Excel, so that I can work at cell level. No hot tracking of rows or cells and when a cell is clicked only that cell is highlighed and not its entire row.
Thanks.
All of this should be acheivable, but since I don't know what isl you are using, I can't tell you what in the isl is causing these settings. There are any number of roles that could be causing the grid to HotTrack. What I would do is open up the isl in AppStylist and go to the grid tab. Mouse over a grid row and look at the list of roles that come up in the tooltip. Examine each role listed and see which one has settings applied to it. Specifically, check for the HotTracking state on the tabs at the bottom.
AppStylist styles the application at a global level. You can typically override the AppStylist settings in code only on individual objects like a specific header or cell.
So this line of code works because you are setting a property on one individual header object:
.DisplayLayout.Bands(0).Columns(i).Header.Appearance.TextHAlign = HAlign.Right
This line of code does not work, because you are setting a property on the DisplayLayout level and so AppStylist takes precedence:
.DisplayLayout.Override.HotTrackHeaderAppearance.TextHAlign = HAlign.Right
So there are potentially two ways to achieve what you want here. The first way would be to set the HotTrackAppearance on the header, in addition to the Appearance. This, unfortunately, is not possible, since the Header has no such property. The Header's HotTracking is only settable on the Override, so there is no way to override it in the application.
I recommend that you Submit a feature request to Infragistics for a HotTrackAppearance on the Header object.
The second approach to simply remove the Header Alignment settings from the AppStylist file entirely and set it only in code.
my UltraGrid Hottrack settings are in the ISL file.
In the ISL file my header appearance of the grid is set to Halignment: is Left. (normal state)
In the ISL file my header appearance of the grid is also set with hottracking state --> HAlignment is left.
I have written some code, to turn the HAlignment if it is a currency column to the right., for both cellappearance en headerappearence, something like this:
If CInt(row("IsBedrag")) <> 0 Then
With mvarFlexGrid
.DisplayLayout.Bands(0).Columns(i).CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right
This does work. the problem i have is that the text of the header is aligned right but if i hottrack it with the mouse, the text jumps to left, because the hottracking alignment in isl is set to left.
With the above lines of code, i overruled apparentlyI the alignment of the normal state, i also want to overrule the alignment of the hottracked state.
So i added to following lines, but is still doesn't work..
How can it be, i am able to overrule the normal state alignment, but not the hottracked state alignment?
There's no switch for turning HotTracking on and off. The grid will HotTrack the rows if there is a HotTrackAppearance defined, either in the code or in AppStylist.
If it's defined in the code, then you can simply reset it to turn it off.
Something like this:
this.ultraGrid1.DisplayLayout.Override.ResetHotTrackRowAppearance
If it's on in AppStylist, then you have to turn it off within your isl file. If you have some grids that need HotTracking and others that do not, then what you could do is reset the HotTracking state of the UltraGridRow UIRole in the default StyleSet in your isl file. Then you add a new StyleSet and set it to be BasedOn the default StyleSet so it picks up all of it's properties. Then you add HotTracking to the new StyleSet.
Then, all you have to do is turn on HotTracking for the grids you want in your application by setting the StyleSetName on those grids to the name of the new StyleSet you created.
Is there a way to stop the hot tracking by code?
I like the hot tracking but some grids are read-only where hot tracking does not make too much sense. In those cases I would like to something like this:
Grid.hottracking = false
Grid.ActiveRow = none
I've been working on turning off the hot track issue using a style sheet for the past two days and I finally found the fix!! For those of you still having issues...I had to change the Hot Track properties in two places. First I opened my style sheet and selected the "Grid" tab. I moused over the grid row and selected the "GridRow" from the list. Then down below in the properties window I selected the "Common States" tab and made sure that the "HotTracked" backcolor was set to default or Transparent. I then selected the "GridCell" from the list and selected the "Grid States" tab from the properties below and selected "RowHotTracked" and again made sure to set the backcolor to default or Transparent.