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
245
Derived UltraWinGrid loses appearance settings.
posted

 

Hi,

I am creating my own ultrawingrid control that inherits ultrawingrid and I want to apply apearance settings without manually going through some dialog gui to do it. I have set appearance settings in the constructor of the control but they are getting reset every time the control is dragged from the toolbox to the form, how can I keep the appearance settings I set in the code without them being reset?

Thanks,

Carl.

here is my example:

 

 

    public class Grid : UltraGrid

    {

 

 public Grid()

        {

            gridAppearance.BackColor = System.Drawing.Color.White;

            DisplayLayout.Appearance = gridAppearance;

            DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns;

 

            ultraGridColumnIsDirty.Header.VisiblePosition = 0;

            ultraGridColumnIsDirty.Width = 27;

            ultraGridColumnOnline.Header.VisiblePosition = 1;

            ultraGridColumnOnline.Width = 113;

            ultraGridColumnLastModified.Header.VisiblePosition = 2;

            ultraGridColumnLastModified.Width = 465;

 

            ultraGridBandDefaultBand.Columns.AddRange(new object[] {

            ultraGridColumnIsDirty,

            ultraGridColumnOnline,

            ultraGridColumnLastModified });

 

            ultraGridBandDefaultBand.Override.AllowRowSummaries = Infragistics.Win.UltraWinGrid.AllowRowSummaries.False;

            ultraGridBandDefaultBand.Override.GroupBySummaryDisplayStyle = Infragistics.Win.UltraWinGrid.GroupBySummaryDisplayStyle.SummaryCells;

            ultraGridBandDefaultBand.Override.SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.InGroupByRows;

            DisplayLayout.BandsSerializer.Add(ultraGridBandDefaultBand);

            DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.None;

            groupByBoxAppearance.FontData.Name = "Microsoft Sans Serif";

            groupByBoxAppearance.FontData.SizeInPoints = 10F;

            groupByBoxAppearance.ForeColor = System.Drawing.Color.Black;

            groupByBoxAppearance.ImageBackgroundStyle = Infragistics.Win.ImageBackgroundStyle.Stretched;

            DisplayLayout.GroupByBox.Appearance = groupByBoxAppearance;

            bandLabelAppearance.ForeColor = System.Drawing.Color.Black;

            DisplayLayout.GroupByBox.BandLabelAppearance = bandLabelAppearance;

            DisplayLayout.GroupByBox.ButtonConnectorStyle = Infragistics.Win.UIElementBorderStyle.WindowsVista;

            DisplayLayout.MaxColScrollRegions = 1;

            DisplayLayout.MaxRowScrollRegions = 1;

            DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.No;

            DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;

            DisplayLayout.Override.AllowRowSummaries = Infragistics.Win.UltraWinGrid.AllowRowSummaries.False;

            DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.True;

            DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.None;

            DisplayLayout.Override.BorderStyleHeader = Infragistics.Win.UIElementBorderStyle.None;

            DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.None;

            cellAppearance.BorderColor = System.Drawing.Color.Transparent;

            cellAppearance.FontData.Name = "Microsoft Sans Serif";

            cellAppearance.FontData.SizeInPoints = 8F;

            DisplayLayout.Override.CellAppearance = cellAppearance;

            DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect;

            DisplayLayout.Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.FilterRow;

            DisplayLayout.Override.FixedHeaderIndicator = Infragistics.Win.UltraWinGrid.FixedHeaderIndicator.None;

            groupByRowAppearance.BackColor = System.Drawing.Color.LightGray;

            DisplayLayout.Override.GroupByRowAppearance = groupByRowAppearance;

            headerAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.None;

            headerAppearance.FontData.Name = "Microsoft Sans Serif";

            headerAppearance.FontData.SizeInPoints = 8F;

            headerAppearance.ForeColor = System.Drawing.Color.White;

            headerAppearance.ImageBackground = global::CCC.Portal.Common.Properties.Resources.GridHeader;

            headerAppearance.ImageBackgroundStyle = Infragistics.Win.ImageBackgroundStyle.Tiled;

            headerAppearance.TextHAlignAsString = "Left";

            headerAppearance.ThemedElementAlpha = Infragistics.Win.Alpha.Transparent;

            DisplayLayout.Override.HeaderAppearance = headerAppearance;

            DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;

            DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.XPThemed;

            rowAlternateAppearance.BackColor = System.Drawing.Color.Gainsboro;

            DisplayLayout.Override.RowAlternateAppearance = rowAlternateAppearance;

            rowAppearance.BorderColor = System.Drawing.Color.Transparent;

            DisplayLayout.Override.RowAppearance = rowAppearance;

            rowSelectorAppearance.BackColor = System.Drawing.Color.White;

            rowSelectorAppearance.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));

            DisplayLayout.Override.RowSelectorAppearance = rowSelectorAppearance;

            selectedRowAppearance.ImageBackground = global::CCC.Portal.Common.Properties.Resources.HotTrackBackGround;

            selectedRowAppearance.ImageBackgroundStretchMargins = new Infragistics.Win.ImageBackgroundStretchMargins(1, 1, 1, 4);

            selectedRowAppearance.ImageBackgroundStyle = Infragistics.Win.ImageBackgroundStyle.Stretched;

            DisplayLayout.Override.SelectedRowAppearance = selectedRowAppearance;

            DisplayLayout.Override.SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.Top;

            scrollBarLookAppearance.ImageBackgroundStretchMargins = new Infragistics.Win.ImageBackgroundStretchMargins(2, 4, 2, 4);

            scrollBarLookAppearance.ImageBackgroundStyle = Infragistics.Win.ImageBackgroundStyle.Stretched;

            scrollBarLook.Appearance = scrollBarLookAppearance;

            scrollBarLook.ViewStyle = Infragistics.Win.UltraWinScrollBar.ScrollBarViewStyle.Outlook2007;    

            DisplayLayout.ScrollBarLook = scrollBarLook;

            DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;

            DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;

            DisplayLayout.UseFixedHeaders = true;

            Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);

            UpdateMode = Infragistics.Win.UltraWinGrid.UpdateMode.OnCellChange;

            UseOsThemes = Infragistics.Win.DefaultableBoolean.False;

        }

}

 

 

Parents
  • 469350
    Offline posted

    My guess is that your grid is still linked up to the UltraGrid's Designer, which is set up to load a default Preset into the grid, which may be overwriting some of your settings.

    You can turn this off by going into the grid designer and going to the Presets -- > Manager Presets page and unchecking "Apply this Preset to grids created at design-time" box.

Reply Children