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

Parents
No Data
Reply
  • 270
    posted

    Hi again,

    thanks for your answers. I think both solutions would work - and I found the third one: I found out how to set all my desired properties (in my case it was the font of the column headers) within the DisplayLayout object. So it could be stored in the lyt-File using the layout wizard.

    I provide a helper method that loads an embedded lyt-File and applies it at InitializeLayout to the grid. This works fine for me and my team.

    Do you think this solution is ok?

    - Achim

    PS: I think I have found a bug in the layout wizard. The wizard loads and saves all categories regardless what I have selected.

Children