Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
200
Row highlight behaviour for UltraGrid
posted

Hello,

 I have a window with a number of different UltraGrids objects.  I'd like,

- A single row on a grid to be selected when someone clicks on a cell.  This works;

- To enable multi-row selection via the row selection tabs on the LHS of the grid.  This works.

- To only display the highlighted rows on the currently active grid.  Hence I'd like the row highlights to disappear on a grid when another grid is selected.  I'd like to achieve this without deselecting the selected rows on the current grid.  I can't find the settings to enable this.  Currently when I select another grid, the selected rows on all the other grids are also displayed.

- When a grid is populated it automatically highlights the first row in the grid.  I'd like to disable this so that rows are only hightlighted when someone selects a row.  I can't find the settings to enable this.

Is anyone able to point me in the right direction on how this could be achieved?

Current grid setting follow.

With thanks in advance.

 

   appearance1.BackColor = System.Drawing.SystemColors.Window;
   appearance1.BorderColor = System.Drawing.SystemColors.InactiveCaption;
   mDataGrid.DisplayLayout.Appearance = appearance1;
   mDataGrid.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
   mDataGrid.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;
   appearance2.BackColor = System.Drawing.SystemColors.ActiveBorder;
   appearance2.BackColor2 = System.Drawing.SystemColors.ControlDark;
   appearance2.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
   appearance2.BorderColor = System.Drawing.SystemColors.Window;
   mDataGrid.DisplayLayout.GroupByBox.Appearance = appearance2;
   appearance3.ForeColor = System.Drawing.SystemColors.GrayText;
   mDataGrid.DisplayLayout.GroupByBox.BandLabelAppearance = appearance3;
   mDataGrid.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
   mDataGrid.DisplayLayout.GroupByBox.Hidden = true;
   appearance4.BackColor = System.Drawing.SystemColors.ControlLightLight;
   appearance4.BackColor2 = System.Drawing.SystemColors.Control;
   appearance4.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
   appearance4.ForeColor = System.Drawing.SystemColors.GrayText;
   mDataGrid.DisplayLayout.GroupByBox.PromptAppearance = appearance4;
   mDataGrid.DisplayLayout.MaxRowScrollRegions = 1;
   appearance5.BackColor = System.Drawing.SystemColors.Window;
   appearance5.ForeColor = System.Drawing.SystemColors.ControlText;
   mDataGrid.DisplayLayout.Override.ActiveCellAppearance = appearance5;
   appearance6.BackColor = System.Drawing.SystemColors.Highlight;
   appearance6.ForeColor = System.Drawing.SystemColors.HighlightText;
   mDataGrid.DisplayLayout.Override.ActiveRowAppearance = appearance6;
   mDataGrid.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.No;
   mDataGrid.DisplayLayout.Override.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.Free;
   mDataGrid.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
   mDataGrid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
   mDataGrid.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
   mDataGrid.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Dotted;
   mDataGrid.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted;
   appearance7.BackColor = System.Drawing.SystemColors.Window;
   mDataGrid.DisplayLayout.Override.CardAreaAppearance = appearance7;
   appearance8.BorderColor = System.Drawing.Color.Silver;
   appearance8.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
   mDataGrid.DisplayLayout.Override.CellAppearance = appearance8;
   mDataGrid.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
   mDataGrid.DisplayLayout.Override.CellPadding = 0;
   mDataGrid.DisplayLayout.Override.ColumnSizingArea = Infragistics.Win.UltraWinGrid.ColumnSizingArea.EntireColumn;
   appearance9.BackColor = System.Drawing.SystemColors.Control;
   appearance9.BackColor2 = System.Drawing.SystemColors.ControlDark;
   appearance9.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;
   appearance9.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
   appearance9.BorderColor = System.Drawing.SystemColors.Window;
   mDataGrid.DisplayLayout.Override.GroupByRowAppearance = appearance9;
   appearance10.TextHAlignAsString = "Left";
   mDataGrid.DisplayLayout.Override.HeaderAppearance = appearance10;
   mDataGrid.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
   mDataGrid.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.WindowsXPCommand;
   appearance11.BackColor = System.Drawing.SystemColors.Window;
   appearance11.BorderColor = System.Drawing.Color.Silver;
   mDataGrid.DisplayLayout.Override.RowAppearance = appearance11;
   mDataGrid.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True;
   mDataGrid.DisplayLayout.Override.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.SingleAutoDrag;
   mDataGrid.DisplayLayout.Override.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.None;
   mDataGrid.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.ExtendedAutoDrag;
   mDataGrid.DisplayLayout.Override.SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.TopFixed;
   appearance12.BackColor = System.Drawing.SystemColors.ControlLight;
   mDataGrid.DisplayLayout.Override.TemplateAddRowAppearance = appearance12;
   mDataGrid.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
   mDataGrid.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
   mDataGrid.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
   mDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
   mDataGrid.Location = System.Drawing.Point(0, 0);
   mDataGrid.Margin = System.Windows.Forms.Padding(0);
   mDataGrid.Name = "mDataGrid";
   mDataGrid.Size = System.Drawing.Size(770, 429);
   mDataGrid.TabIndex = 0;

Parents
No Data
Reply
  • 469350
    Offline posted

    RFPCymba said:
    - To only display the highlighted rows on the currently active grid.  Hence I'd like the row highlights to disappear on a grid when another grid is selected.  I'd like to achieve this without deselecting the selected rows on the current grid.  I can't find the settings to enable this.  Currently when I select another grid, the selected rows on all the other grids are also displayed.

    You are dealing with two separate issues here. There's the ActiveRow and the Selected Rows. The ActiveRow is controlled by the ActiveRowAppearance. The selected rows are controlled by the SelectedRowAppearance. 

    For the ActiveRow, this is pretty easy. You can change the ActiveRowAppearance in the grid's Enter and Leave events. So in the Leave event you reset the ActiveRowAppearance and then in the Enter event, you set it back. 

    For the selected rows, this will not work, because when you reset the SelectedRowAppearance, the grid still applies a default BackColor and ForeColor. There is no way to turn this off. So the only way to do something like this would be to use a DrawFilter. This would not be trivial because you would need some way to determine the un-selected BackColor and ForeColor of the row. This may or may not be easy depending on what other appearances you are applying to the grid. 

     

    RFPCymba said:
    - When a grid is populated it automatically highlights the first row in the grid.  I'd like to disable this so that rows are only hightlighted when someone selects a row.  I can't find the settings to enable this.

    This is most likely occuring because the row in question is the ActiveRow. By default, the grid syunchronizes it's ActiveRow with the current Position of the DotNet CurrencyManager. So one way to deal with this is to set SyncWithCurrencyManager to false. This, of course, has other implications, so it may or may not be a viable solution for your application.

Children