When changing a checkbox column on band(1) "ISREQUIRED" to be left aligned it makes a completely different (key = "CLOSE") column in band(0) also left-aligned. Can't seperate the two ... ALSO changing the autofitstyle on one band changes it on the other (last one that gets set wins)... the column sizing is set to "free" I am specifying the band to change. There is nothing setup via the wizard ... I am banding a dataset with two related tables and setting all properties and unbound columns programatically, either in the form_load event or the grid_initializeLayout event. [code below] PLEASE HELP ... driving me crazy :)
<Called from Form_Load>
Private Sub LoadGrid()
Dim DS As Data.DataSet
DS = dbAssist.MultiSelect("usp_list_grid_jobruns")
Dim data_relation As New _ DataRelation("MyRelation", DS.Tables(0).Columns("ID_Job"), DS.Tables(1).Columns("ID_Job"))
DS.Relations.Add(data_relation)
JobRunGrid.DisplayLayout.ViewStyle = Infragistics.Win.UltraWinGrid.ViewStyle.MultiBand
JobRunGrid.DataSource = DS
JobRunGrid.DisplayLayout.Bands(1).CardView = True
' Add Fonts and Font Sizes JobRunGrid.DisplayLayout.Appearance.FontData.SizeInPoints = 10 JobRunGrid.DisplayLayout.Appearance.FontData.Name = "Segoe UI"
JobRunGrid.DisplayLayout.Bands(0).Header.Appearance.FontData.SizeInPoints = 10 JobRunGrid.DisplayLayout.Bands(0).Header.Appearance.FontData.Name = "Segoe UI"
' Add Unbound Columns JobRunGrid.DisplayLayout.Bands(0).Columns.Add("Close") JobRunGrid.DisplayLayout.Bands(0).Columns("Close").DataType = GetType(Boolean) JobRunGrid.DisplayLayout.Bands(0).Columns("Close").CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.Edit
JobRunGrid.DisplayLayout.Bands(0).Columns.Add("Timed") JobRunGrid.DisplayLayout.Bands(0).Columns("Timed").DataType = GetType(String)
' Hide Certain Columns JobRunGrid.DisplayLayout.Bands(0).Columns("JobRunID").Hidden = True JobRunGrid.DisplayLayout.Bands(0).Columns("ID_Job").Hidden = True JobRunGrid.DisplayLayout.Bands(0).Columns("DisplayOnHold").Hidden = True JobRunGrid.DisplayLayout.Bands(0).Columns("LateWarningDelay").Hidden = True JobRunGrid.DisplayLayout.Bands(0).Columns("DateCreated").Hidden = True JobRunGrid.DisplayLayout.Bands(0).Columns("Schedule").Hidden = True
' Set Header Captions (Names) JobRunGrid.DisplayLayout.Bands(0).Columns("CustomerName").Header.Caption = "Customer" JobRunGrid.DisplayLayout.Bands(0).Columns("JobName").Header.Caption = "Job Name" JobRunGrid.DisplayLayout.Bands(0).Columns("ServerType").Header.Caption = "Type"
' Set Column Widths JobRunGrid.DisplayLayout.Bands(0).Columns("CustomerName").Width = 350 JobRunGrid.DisplayLayout.Bands(0).Columns("JobName").Width = 350 JobRunGrid.DisplayLayout.Bands(0).Columns("ServerType").Width = 90 JobRunGrid.DisplayLayout.Bands(0).Columns("Status").Width = 90 JobRunGrid.DisplayLayout.Bands(0).Columns("Timed").Width = 120
' Set Column Order JobRunGrid.DisplayLayout.Bands(0).Columns("CustomerName").Header.VisiblePosition = 1 JobRunGrid.DisplayLayout.Bands(0).Columns("JobName").Header.VisiblePosition = 2 JobRunGrid.DisplayLayout.Bands(0).Columns("Timed").Header.VisiblePosition = 3 JobRunGrid.DisplayLayout.Bands(0).Columns("Status").Header.VisiblePosition = 4 JobRunGrid.DisplayLayout.Bands(0).Columns("Close").Header.VisiblePosition = 5
JobRunGrid.DisplayLayout.Bands(1).CardSettings.AutoFit = False JobRunGrid.DisplayLayout.Bands(1).CardSettings.ShowCaption = False JobRunGrid.DisplayLayout.Bands(1).CardSettings.Width = 375
End Sub
<Grid InitializeLayout>
e.Layout.Bands(1).Override.HeaderAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.GlassBottom37Bright e.Layout.Bands(1).Override.HeaderAppearance.BackColor = Color.BurlyWood e.Layout.Bands(1).Override.HeaderAppearance.BackColor2 = Color.Sienna e.Layout.Bands(1).Override.CellAppearance.BackColor = Color.BurlyWood
e.Layout.Bands(0).Override.CellAppearance.BackColor = Color.LightCyan e.Layout.Bands(0).Override.HeaderAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.GlassBottom20Bright e.Layout.Bands(0).Override.HeaderAppearance.BackColor = Color.WhiteSmoke e.Layout.Bands(0).Override.HeaderAppearance.BackColor2 = Color.SeaGreen
e.Layout.Bands(0).Override.HeaderAppearance.TextHAlign = Infragistics.Win.HAlign.Center e.Layout.Bands(1).Override.HeaderAppearance.TextHAlign = Infragistics.Win.HAlign.Center
e.Layout.Bands(0).Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect e.Layout.Bands(1).Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect
e.Layout.Override.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.Free e.Layout.Bands(0).Layout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ExtendLastColumne.Layout.Bands(1).Layout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.None
[both bands end up with autofit set to "None", if I reverse it then BOTH bands end up with "ExtendLastColumn"]
Hi,
The Layout property on the band is a backward pointer. So:
e.Layout.Bands[0].Layout is the same as e.Layout.
There isn't a separate layout for each band, and the AutoFitStyle property affects the entire grid. There's no way to do this for a single band.
I am looking at a similar situation
I want Band 0 to have no AddNew but Band 1 to have AddNew. But what happens is that they both have AddNew. The tool tip for the Layout.Override says the settings will be applied to the specific band. What am I doing wrong?
void gridCalculations_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
e.Layout.Bands[0].Layout.Override.AllowAddNew = AllowAddNew.No;
e.Layout.Bands[1].Layout.Override.AllowAddNew = AllowAddNew.TemplateOnTop;
}
I don't understand this but I was able to get it to work with the following:
private void gridCalculations_InitializeLayout(object sender, InitializeLayoutEventArgs e){ gridCalculations.DisplayLayout.Bands[0].Override.AllowAddNew = AllowAddNew.No; gridCalculations.DisplayLayout.Bands[1].Override.AllowAddNew = AllowAddNew.TemplateOnTop;}
This tells me that
e.Layout.Bands[0].Layout.Override is not equivalent to gridCalculations.DisplayLayout.Bands[0].Override
I have an interesting side affect with this approach! There should only be one add new row template for the band but I get 12. Is there a way to send you an image and the gridlayout properties along with the dataset xml file to load?
josephsimpkins said: void gridCalculations_InitializeLayout(object sender, InitializeLayoutEventArgs e) { e.Layout.Bands[0].Layout.Override.AllowAddNew = AllowAddNew.No; e.Layout.Bands[1].Layout.Override.AllowAddNew = AllowAddNew.TemplateOnTop; }
The reason this doesn't work is the same reason I explained in my previous post. You are setting the AllowAddNew on the same object twice.
The Layout property on the band is a backward pointer. So e.Layout and e.Layout.Bands[x].Layout are exactly the same object.
josephsimpkins said:I have an interesting side affect with this approach! There should only be one add new row template for the band but I get 12. Is there a way to send you an image and the gridlayout properties along with the dataset xml file to load?
You should be seeing an AddNewRow for each island of rows in Band 1. That is, one AddNew row under each parent row.
You can attach an image to your post by going to the options tab when posting.