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
270
Configure Grid at Runtime
posted

Hi there,

I tried to provide some project-wide design presets via the Layout Manager but unfortunately some basic  properties are not stored in the *.lyt-file. So I created a helper method that sets some appearances and properties to fit my project's needs (it's just like the designer generated code).

So my question is, where do I have to place code like this:

ultraWinGrid.DisplayLayout.Appearance = appearance1;
            ultraWinGrid.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns;
            ultraWinGrid.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;
            ultraWinGrid.DisplayLayout.GroupByBox.Hidden = true;
            ultraWinGrid.DisplayLayout.InterBandSpacing = 10;
            ultraWinGrid.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.No;
            ultraWinGrid.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
            ultraWinGrid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
            ultraWinGrid.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
            ultraWinGrid.DisplayLayout.Override.CardAreaAppearance = appearance2;
            ultraWinGrid.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect;
            ultraWinGrid.DisplayLayout.Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.HeaderIcons;
            ultraWinGrid.DisplayLayout.Override.HeaderAppearance = appearance3;
            ultraWinGrid.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
            ultraWinGrid.DisplayLayout.Override.RowAlternateAppearance = appearance4;
            ultraWinGrid.DisplayLayout.Override.RowAppearance = appearance5;
            ultraWinGrid.DisplayLayout.Override.RowSelectorAppearance = appearance6;
            ultraWinGrid.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
            ultraWinGrid.DisplayLayout.Override.RowSelectorWidth = 12;
            ultraWinGrid.DisplayLayout.Override.RowSpacingBefore = 0;
            ultraWinGrid.DisplayLayout.Override.SelectedRowAppearance = appearance7;
            ultraWinGrid.DisplayLayout.Override.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.None;
            ultraWinGrid.DisplayLayout.Override.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.None;
            ultraWinGrid.DisplayLayout.Override.SelectTypeGroupByRow = Infragistics.Win.UltraWinGrid.SelectType.None;
            ultraWinGrid.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Extended;
            ultraWinGrid.DisplayLayout.RowConnectorColor = System.Drawing.Color.FromArgb(((int)(((byte)(170)))), ((int)(((byte)(184)))), ((int)(((byte)(131)))));
            ultraWinGrid.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
            ultraWinGrid.DisplayLayout.TabNavigation = Infragistics.Win.UltraWinGrid.TabNavigation.NextControlOnLastCell;
            ultraWinGrid.DisplayLayout.ViewStyle = Infragistics.Win.UltraWinGrid.ViewStyle.SingleBand;
            ultraWinGrid.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
            ultraWinGrid.Font = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

 

For any help, thanks in advance.

- Achim

  • 469350
    Suggested Answer
    Offline posted

    It looks to me like this would be an ideal case for using a Preset, rather than a Layout. Most, if not all, of the properties you are setting here should be available on the Preset.

  • 69832
    Verified Answer
    Offline posted

    Handle the InitializeLayout event, and in your case, change all occurrences of "ultraWinGrid.DisplayLayout." to "e.Layout"