I'd like to create a custom column chooser with a couple check boxes at the top. Is there a way to be able to do this? It seems to me that there should be a template that you can just add extra stuff to if you like.
I've been going through other posts on similar topics but they're all so old and I don't know what the current version can do.
Hello,
I am glad to hear that you have resolved your issue.
If you would like to see a certain functionality implemented in our future releases, you can submit a feature request on our product ideas web site.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Furthermore, I would like to inform you that based on this thread after a discussion with our development team select/unselect functionality for all checkbox to the column chooser is included the backlog.
In order to check what new is available for new releases you can refer to the “What is new” section here.
Thank you for using Infragistics Components.
Sincerely,Tihomir TonevAssociate Software DeveloperInfragistics
Ok, so I used the 2nd method and it works beautifully.
Thanks. Perhaps this can be made easier by providing us with a template that we can easily alter, perhaps even exposing some of this stuff in public methods.
Okay, I took another look and it seems like the Visible field is backed up by the actual Hidden property of the column. So changing it in code doesn't trigger a change to the actual Hidden property and the columnChooser grid just re-loads the value from the hidden property of the column immediately, So that won't work. So what you need to do is get the actual grid column associated with the row and set it's hidden property.
One way you could do that would be to get the "Value" column and look at it's ToString and then parse out the Key of the column by removing the brackets. That's kind of a hack, but it works in a simple case where you only have one band in your grid.
foreach (var row in this.columnChooserGrid.Rows) { var valueCell = row.Cells["Value"]; var columnBandHolder = valueCell.Value; var columnKey = columnBandHolder.ToString().Replace('{', '\0').Replace('}', '\0'); var gridColumn = this.ultraGrid1.DisplayLayout.Bands[0].Columns[columnKey]; gridColumn.Hidden = true; }
If you application has full trust, as most WinForms applications do, then you could take another approach. The Value cell contains an object of type ColumnBandHolder, which is internal. And it is on that object that the actual reference to the grid column is stored. So if you don't mind using reflection, a more reliable way to get the column would be like this:
foreach (var row in this.columnChooserGrid.Rows) { var valueCell = row.Cells["Value"]; var columnBandHolder = valueCell.Value; var valueProperty = columnBandHolder.GetType().GetProperty("Value"); var gridColumn = valueProperty.GetValue(columnBandHolder) as UltraGridColumn; gridColumn.Hidden = true; }
Seems right to me. It's not working?
Maybe put a breakpoint in there and examine the row.Cell["Value"].Value. I noticed that the column's datatype is string for some reason. So maybe you need to set it to a string. Seems weird.
Another possibility is that something else in the ColumnChooser is interfering with your code and not allowing you to change the value.
It could also be a timing thing. I assume this code is in the CheckedChanged event of a CheckBox? It won't work inside of UltraGrid1_BeforeColumnChooserDisplayed, because whatever you change in there will be overwritten when the column chooser initializes the state of the checkboxes. That happens later.
The other one does a deselect all. And currently I'm trying to actually get the checks to change and I can't seem to find the right code. Here's what I've got.
UltraGrid grid = (UltraGrid)col.Dialog.Controls.Find("displayGrid", true).First(); foreach (var row in grid.Rows) { row.Cells["Visible"].Value = false; }
Now as for what I'm doing with all this, I just want some more user friendly interaction. The UC I made is working out great. I just dock it at the top. I've attached a pic. I haven't gotten formatting down yet as I'm still getting it to work and I'll format and apply styles later.