I am grouping data in a grid by two different columns.
One of the columns needs to be retained as visible and the other needs to be removed from the grid.
I have set "ShowGroupedColumns" to false as it automatically handles the column chooser etc.
But I cant seem to figure out how to make the one I want to retain visible.
Is there any way, with ShowGroupedColumns set to false that I can have it grouped by column and have the column in the grid too?
Thanks
The same problem have been already discussed in DevExpress Support Center:
Display individual columns, even if they are grouped
Related
I first would like to say that I am fairly new to UWP, and my experience with Android is probably leading some some assumptions on my end. There may be a better way about this, but so far I have been trying to use the Grid class, but it doesn't seem to work in a way that I would expect.
Basic Idea
I am trying to create a UWP application with the ability of organizing elements in a matrix, where each row and column represents some category, and whatever element that is within both row and column categories is placed in that cell. One or more elements can be listed in each matrix coordinate. An image for reference is below:
To give a more clearer/specific example, let's say the Elements were Employees, rows were Teams, and columns were disciplines (Testing, Dev, Management)
Comparing different category-types can be useful for displaying information, but this will have greater importance beyond just names, so this is only a simplified example. Also, as shown in the example, the number of rows and columns is determined by the number of categories there are for each respectively (e.g. # rows = # teams and # columns = # disciplines).
I don't have any code to show, simply because this isn't so much an error problem as it is a conceptual problem.
My Questions
How would I be able to filter what elements are bound to a cell by their Row/Column? Is this even possible?
i.e. populating the cells of the matrix with elements that occupy both the corresponding row's and column's category.
How do I bind columns and rows to their respective list of categories?
e.g. whenever I add another Column Category, a new empty column will be generated.
I appreciate your help and time!
For your scenario, the better way is using DataGrid to replace.
i.e. populating the cells of the matrix with elements that occupy both the corresponding row's and column's category.
You could use binding way to specific current element in which column and row, but you need to calculate before preparing data source for Grid panel.
whenever I add another Column Category, a new empty column will be generated.
If you use DataGrid, it will generate Column base on your item's new filed. Here is code sample that your could refer.
In my WPF application, I am using a DataGrid control. I allow the user to reorder columns. However, I have to ensure that the first two columns and the last column cannot be reordered.
All the columns are generated programmatically using new DataGridTextColumn().
I am wondering if someone can guide me on what I need to do to accomplish this? Thank you in advance for your help.
You can use the DataGrid.FrozenColumnCount Property to not allow the users to move columns.
However, if you look at the documentation, you will see that you can only do this for the first x columns from the left side of the DataGrid. For example, if you set the FrozenColumnCount to 2, the two left columns in the display are frozen.
Use DataGridColumn.CanUserReorder property (set tis property to false for columns, which can't be reordered).
I've added repositoryItemCheckEdit in a xtragrid control's column. And i'm having total 3 columns in my xtragridview. From which two columns will be filled with the help of fields from my table when i'm setting datasource property of gridcontrol.
problem which is i'm facing is that when i'm changing the status of checkbox from xtragrid to checked for one time it works but when i'm checking from next row that time the previous selection of checkbox from gridview lost. It only maintain for only one row. and i want it two remain for multiple row.
how to do this?
my datatable contains two fields as TemplateTitle & TemplateBody. And my xtragrid contains three columns as two from datatable & additional column as a repositoryItemCheckEdit which is unbound column. I created columns of gridview at design time. and i've set just datasource property of gridcontrol to datatable.
thanks.
If the repositoryItemCheckEdit is unbound you have to control the CheckEdit's checked state manually using the grid's CustomUnboundColumnData event otherwise the state is lost when you move to a different row.
You must search DevExpress support center for these type of issues. These are pretty well documented and can be found easily there.
http://www.devexpress.com/Support/Center/p/B135631.aspx
http://www.devexpress.com/Support/Center/p/Q254784.aspx
Using BindingList and not DataTable or ObservableCollection solves the problem for booleans bound to a checkbox in a (DevExpress) GridView/GridControl ( Windows Forms ).
Howdy, using vs2008 winforms.
I want to be able to use a slightly customised datagridview but cant think of a way to do it.
i have
1. a sqldataadaptor fill a dataset
2. a binding source bound to the dataset
3 a datagridview with the bindingsource set as the datasource.
I want the binding to allow sync between the dataset and datagridview, so i can edit data and then update to database with sqldataadaptor. update.
I want to show some custom columns that are calculated results.
And i want to show a final bottom row that is totals of all the columns in the DVG.
My problem is once the DGV is bound i cant add a custom column or row, it wont let me.
I know i could add it directly to the dataset that is the underlying datasource but then by changing the structure of the dataset i cant update to a database once edits have taken place.
or can i ???
Can someone tell me how i can add my custom columns and a final total row to a bound DGV.
Also while im here, if i click on the top of a column to sort on it, in a bound DGV, will it also re-sort the underlying dataset, so i i edit things will still stay synced ?
thanks in advance for any help
Yes, you can.
The adapter does not care about structure. It only cares about column names used in the Select/Insert/Update/Delete commands. You can add custom columns, expression columns, columns for subtotals, columns for totals, or whatever you need. Even change the order of the columns. I do advise adding a sort column, so you can keep the custom rows in the proper place when you or the user sorts.
You can do the same thing for custom rows. When you update through the adapter, you handle the RowUpdating event and set the SqlRowUpdatingEventArgs.Status to SkipCurrentRow for these custom rows. I strongly advise creating a row type column so you know which rows to skip when updating. (You can also use the sort column's value as a key to skip rows.)
There are a couple of articles on MSDN or KB that illustrate how to add total rows.
"How to sum the fields in a Windows Forms DataGrid control and then display the calculated totals in a footer by using Visual Basic .NET" at http://support.microsoft.com/kb/836672.
In my experience, manipulate the data table first before binding. Do what you need to do in order to support the grid and the grid's interface. It is okay to manipulate the data, add/change/remove columns and rows, then rebind when needed.
To be able to add additional unbound columns to your DataGridView you could also set its AutoGenerateColumns property to false and then add custom columns with the following method:
dataGridView->Columns->Add(...)
To calculate the contents of the unbound columns you can handle the CellValueNeeded and CellValuePushed events but you must set the DataGridView into 'virtual mode' by setting the VirtualMode property to true in order for the eventhandlers to be invoked.
Hope this helps a little....
I have an app that lets the user reorder columns in a DataGridView, and I want to save the "layout" upon closing the app...but it seems that when I iterate through the column collection, I get them in the order I added them, not the order they appear on screen. Is there a way to get the displayed ordering?
edit: found it, just check the DisplayIndex property of each column :)
You'll have to use the DataGridViewColumn.DisplayIndex property. http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.displayindex.aspx