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
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?
PS: I think I have found a bug in the layout wizard. The wizard loads and saves all categories regardless what I have selected.
moojoo said: 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?
A Layout will only work if all of the grids you are using around bound to exactly the same data structure. If you are using grids that load up different bands or columns, then the layout will not load into a grid that does not match the structure for which it was saved.
A preset is independent of the data structure.
moojoo said:PS: I think I have found a bug in the layout wizard. The wizard loads and saves all categories regardless what I have selected.
Some property categories have prerequisites of other categories. So I suspect it's not saving or loading everything, but it's saving more than expect because you are specifying a category that need other categories. For example, you cannot save/load the filtering without also saving/load the columns.