Here is another question I should be able to figure out, but can not seem to find it...
How do you get the WinGrid to sort when you click on the column header? Band[1] sorts, but Band[0] doesn't sort. I want Band[0] to be the one that will sort, and I do NOT want Band[1] sorting.
It is my impression that this is the default behavior so I am guessing I changed something I should not have. The other possibility is the fact that I am using my own custom dataset. The collection that is being displayed is:
class ChoiceSetList : BindingList<ChoiceSet>{}
Here is the designer code as it stands now:
// // dgChoiceSets // this.dgChoiceSets.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dgChoiceSets.DataMember = "ChoiceSetList"; this.dgChoiceSets.DataSource = this.choiceSetPickerBindingSource; this.dgChoiceSets.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns; ultraGridColumn1.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append; ultraGridColumn1.Header.VisiblePosition = 6; ultraGridColumn2.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append; ultraGridColumn2.Header.Caption = "#"; ultraGridColumn2.Header.VisiblePosition = 1; ultraGridColumn2.MaxWidth = 24; ultraGridColumn2.MinWidth = 24; ultraGridColumn2.RowLayoutColumnInfo.OriginX = 2; ultraGridColumn2.RowLayoutColumnInfo.OriginY = 0; ultraGridColumn2.RowLayoutColumnInfo.SpanX = 2; ultraGridColumn2.RowLayoutColumnInfo.SpanY = 2; ultraGridColumn2.Width = 24; ultraGridColumn3.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append; ultraGridColumn3.Header.VisiblePosition = 0; ultraGridColumn3.RowLayoutColumnInfo.OriginX = 0; ultraGridColumn3.RowLayoutColumnInfo.OriginY = 0; ultraGridColumn3.RowLayoutColumnInfo.SpanX = 2; ultraGridColumn3.RowLayoutColumnInfo.SpanY = 2; ultraGridColumn3.Width = 183; ultraGridColumn4.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append; ultraGridColumn4.Header.VisiblePosition = 2; ultraGridColumn4.Hidden = true; ultraGridColumn5.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append; ultraGridColumn5.Header.VisiblePosition = 3; ultraGridColumn5.Hidden = true; ultraGridColumn6.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append; ultraGridColumn6.Header.VisiblePosition = 4; ultraGridColumn6.Hidden = true; ultraGridColumn7.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append; ultraGridColumn7.Header.VisiblePosition = 5; ultraGridColumn7.Hidden = true; ultraGridBand1.Columns.AddRange(new object[] { ultraGridColumn1, ultraGridColumn2, ultraGridColumn3, ultraGridColumn4, ultraGridColumn5, ultraGridColumn6, ultraGridColumn7}); ultraGridColumn8.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append; ultraGridColumn8.Header.VisiblePosition = 0; ultraGridColumn8.Width = 90; ultraGridColumn9.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Append; ultraGridColumn9.Header.VisiblePosition = 1; ultraGridColumn9.Width = 117; ultraGridBand2.Columns.AddRange(new object[] { ultraGridColumn8, ultraGridColumn9}); ultraGridBand2.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; ultraGridBand2.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False; ultraGridBand2.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.None; this.dgChoiceSets.DisplayLayout.BandsSerializer.Add(ultraGridBand1); this.dgChoiceSets.DisplayLayout.BandsSerializer.Add(ultraGridBand2); this.dgChoiceSets.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False; this.dgChoiceSets.DisplayLayout.InterBandSpacing = 0; this.dgChoiceSets.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.No; this.dgChoiceSets.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False; this.dgChoiceSets.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True; this.dgChoiceSets.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False; this.dgChoiceSets.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.RaisedSoft; this.dgChoiceSets.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.None; this.dgChoiceSets.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect; appearance2.BorderColor = System.Drawing.Color.White; this.dgChoiceSets.DisplayLayout.Override.RowAppearance = appearance2; this.dgChoiceSets.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True; this.dgChoiceSets.DisplayLayout.Override.WrapHeaderText = Infragistics.Win.DefaultableBoolean.False; this.dgChoiceSets.DisplayLayout.RowConnectorStyle = Infragistics.Win.UltraWinGrid.RowConnectorStyle.None; this.dgChoiceSets.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dgChoiceSets.Location = new System.Drawing.Point(12, 33); this.dgChoiceSets.Name = "dgChoiceSets"; this.dgChoiceSets.Size = new System.Drawing.Size(247, 379); this.dgChoiceSets.TabIndex = 0; this.dgChoiceSets.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.dgChoiceSets_InitializeRow); this.dgChoiceSets.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.dgChoiceSets_InitializeLayout); this.dgChoiceSets.AfterSelectChange += new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(this.dgChoiceSets_AfterSelectChange);
Thank you, that answered my question.
Just wondering about the code snippet's from the Designer file... Is there a better way to present them or are is it simply not worth the effort initally? My goal is simply to provide you with the info to allow you minimize the amount of time you spend on my questions.
Sam
Hi,
It's really hard to read a code snippet like this, but I don't see anything here related to sorting.
Sorting is controlled by the HeaderClickAction property on the Override object.
So you need to set this to SortSingle or SortMulti on Band 0's override and None or maybe Select on Band 1's override.