The attached sample contains a form with a grid control.
When running the sample and clicking on the button "Empty" or "Grouped" and then clicking on the button "Simple", all works fine.
If you now activate the "Simple" view and move the column colTypeText to the position before the colType and switch between the views you will get strange behaviors.
Case 1 - switching between "Simple" and "Empty":
- run the application
- click on "Empty" and back to "Simple" -> all fine
- move colTypeText to the position before colType
- click on "Empty" and back to "Simple" -> the colTypeText re-appears at the position where it has been moved to manually. The explicit setting of the VisibleIndex seems to be overridden somehow. If you debug the code which sets the VisibleIndex you will recognize that the VisibleIndex of colTypeText is reset to 1 when setting it to 2 and the VisibleIndex of colType is somehow changed to 2.
Case 2 - switching between "Simple" and "Grouped":
- run the application
- set a break point in ActivateView right after hiding all columns
- click on "Grouped" and back to "Simple" -> this.bandedGridView1.VisibleColumns.Count is 0 but the VisibleIndex of colType is 0. This is really strange because ClearGrouping() has been called and all VisibleColumns have explicitly been set to Visible = false
It looks to me like there is kind of a cache which stores the user customizations and this one is somehow overriding the executed code.
For me it looks like a bug.
Kind regards,
Alex
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Alex,
This behavior is by design. As it is described in the BandedGridColumn.VisibleIndex article, assigning values greater than -1 has no effect. To change the column's position among visible columns in Banded Grid Views, use the GridBandColumnCollection.MoveTo method in the following manner:
case "Simple": { this.gridBand1.Visible = true; //this.colID.VisibleIndex = 0; //this.colType.VisibleIndex = 1; //this.colTypeText.VisibleIndex = 2; this.colID.Visible = true; this.colType.Visible = true; this.colTypeText.Visible = true; gridBand1.Columns.MoveTo(0, colID); gridBand1.Columns.MoveTo(1, colType); gridBand1.Columns.MoveTo(2, colTypeText); this.gridBand2.Visible = true; //this.colNumber.VisibleIndex = 3; //this.colText.VisibleIndex = 4; this.colNumber.Visible = true; this.colText.Visible = true; gridBand1.Columns.MoveTo(3, colNumber); gridBand1.Columns.MoveTo(4, colText); break; }
I hope this information will help you.
Thanks,
John.