wpf datagrid aggregating - wpf

Is it possible to get aggregation with the standard wpf datagrid, similar to the image below (A Telerik Grid)? I dont need summing values, just aggregating values according to one or more columns.

You can use a CollectionView for this, apart from its documentation see linked articles like this. To properly display the Groups you may want to specify a GroupStyle.

Related

Change Columns based on DataType DataGrid WPF

I want to have different columns based on the datatype that is set on the DataGrid.
Example: if I supply ItemsSource of "core.Customer" or "core.ServiceLocation" I want different columns based on that datatype. How do? I constantly find conflicting information. I need guidance for this.
Edit: By the way I was hoping to define the columns via XAML, and load the "template" programmatically or define a "DataType" so it'd immediately know what column template to use.
Also, I have nested properties in my classes that i'd like to display.
Example: Customer class has "BillingName" property. I don't want to display "BillingName" I want to display "BillingName.First" and "BillingName.Last" instead. How to achieve this desired functionality?
After several hours of searching stackoverflow and google I found this which has my exact functionality desired under "Rendering templated columns"

datagrid view with 2 data sources

I'm writing an app where i want to compare the data from two different data sources to see if there are any differences. All examples i have seen of similar functionality always place two datagrids next to each other so that you can see each row side by side.
This makes it very hard to spot differences. What i would like to do is to show the rows one above the other in agridview. That is, alternate the rows in the datagrid to be bound to one then the other datasource as a matched pair. Actually i would also like to add a check box to one row so that the pair can be selected for futher processing.
I know that the controls are very customisable but is something like this possible ? Or would i need to combine the two data sources into a single one and then bind it ?
What you're looking for is MultiBinding
This will enable you to bind multiple items and by using a converter to return a new single item. So essentially, yes, you will combine the two data sources into one inside the converter.

How to properly manage a dynamic table of data for gui

So I need to display a DataGrid in WPF. I'm using RadGridView from Telerik and Caliburn.Micro framework using the MVVM strategy.
In my presentation there are differing number of columns, X+2 to be exact as there is always a Label column and a Total column and then X number of others that hold a decimal number.
I do know the number at runtime before I create the classes I need so that could help.
So I'm currently considering a few methods of doing this but some of them have drawbacks so I would love if someone could point me towards a solution.
Create a ViewModel class for each row and for each Cell. The X number will be a collection and binding to it is problematic. I would need to customize the RadGridView itsefl to actually manage this.
Create a DataTable an the run and bind to it. I haven't managed to make this work and not sure if RadGridView actually supports DataTable. This will also not allow me to keep metadata for each cell, something I need to be easily able to update the cells because column + row aren't the only distinguishing keys I need.
Somehow dynamically create a object with x+2 properties to bind to.
Are there any solutions, guides or something out there to help me here?

Ext.net grouping grid

I'm building an application that displays some results in a grid, using the Ext.NET controls.
The grid is created dynamically, in the C# code-behind. I would like to let the user see the results in a grouped grid, grouped on the first column in the grid.
I want to do this dynamically, from C#, by changing the existing grid.
How should I proceed, what properties should I use?
You need to use GroupingStore To dynamically change grouping, you need to use this store's groupBy and clearGrouping methods.
Here is good example from sencha -
Grouping.html (js source code - grouping.js)
Maybe the following Grouping example can help get you started, see
http://examples.ext.net/#/GridPanel/Miscellaneous/Grouping/

Dynamic row and column span in WPF DataGrid

I'm working on a new project where the design calls for dynamic rows and columns displayed in some form of grid. I think I can accomplish this very hackishly using the plain ol' Grid, but it seems like it should be possible using a "real" grid.
In my mockup, I circled the tricky bit in red. Under column 1, I have effectively 2 columns of data. The problem is the fact that my data in column 1 can span multiple rows. And the fact that column one is really two pseudo columns and each one can span a different number of rows independently. Note: the data is fake and inconsequential. I'm open to ideas for a good implementation. I can fall back to the Grid and do this all in code behind, I'm open to purchasing a datagrid that may have more power than the DataGrid and my absolute last resort/preference is to restructure this format to something a little more doable.
Thank you for any ideas you can provide.
Most commercial WPF DataGrid implementations handle hierarchical data like this. For example, Telerik's DataGrid (part of RadControls for WPF) supports hierarchical data in multiple formats.
Typically, the default styling is a bit different than yours above, but can be adapted to that format via styling.

Resources