Achieving Excel like functionality in WPF - c#

I am struggling with achieving a requirement on a current system.
The system is intended to manage costs and project details and is currently provided through an Excel based solution. Each project consists of a number of weeks which are represented by columns, with a variety of data items presented on the rows. Project lengths are such that many projects have in excess of 150 columns. Columns and data items can be added dynamically, and the user wants to be able to navigate quickly around the grid using keyboard controls.
The business is moving from this unsupported Excel based solution to an application written in C# with a WPF front end, but the users still want a solution close to their existing spreadsheet.
I have initially tried to implement this using the Telerik WPF grid control that I have used elsewhere using dynamic/expando objects to hold the data and using the AutoGeneratingColumn event to create the controls for each of the columns. Initially the performance was acceptable but I had to turn off column and row virtualisation to enable the user to be able to tab through the fields, and this has resulted in a dramatic reduction in performance particularly when adding new rows and using filtering.
Is a grid control the right method to accomplish this requirement – could another third-party grid handle the dynamic column creation better - or is there an alternative design that could achieve both the performance and user interface requirements?

Related

WPF Multiple datagrid causing memory issue

My WPF project has a tabcontrol which hosts multiple datagrid control. Each of the datagrid contains about 1000 rows and users are expected to have more than 10 datagrids open in the same time (with each of them being hosted in different tabpages).
The thing is my application would crash at the 5 - 6th datagrid due to out of memory exception. After hours of research I found out that the only viable way to resolve this issue is to enable UI virtualization. However this is not an option because I need smooth scrolling for my datagrid and enabling UI virtualization would disable smooth scrolling.
Another solution would be to change the scrollunit to pixel instead of item based. This is however also not an option in my case because I am restricted to run the application in .NET Framework 4.0 (the feature is only available in 4.5).
Also I am quite certain that it was the rows that was causing the memory issue because if I run the application without a datagrid I could easily load up to 100s viewmodels.
What I am thinking is would it be possible for me to temporarily dispose controls created in the non-visible tabpages and create them only whenever user navigates to the respective tabpage? Else is there any other way to get around this?
Not using datagrids would help.
While such controls can be convenient to use fact is that they are far from lightweight.
Screen will hold ~30 rows at once so there is no need to pollute memory with thousand of them, having loaded more rows to some dataset can smooth up scrolling as you will be feeding grid with pre-fetched data,
You can even create offline cache in temporary file if data is not changing constantly.

What WPF control should I used to build a high performance grid?

What WPF control should I used to build a high performance grid?
I want to be able to have cell level control so I can update a cell and have the grid only redraw that cell.
The DataGrid doesn't seem to give cell level control.
I need to support 10000 rows with lots of cell updates (say 200 per second).
Thanks
If you dont want to try 3rd party data grids then did u atleast give WPF Datagrid a try? It does support virtualization at row and column level. Plus cell level control is available thru CellStyle for DataGridCell type. You can even attach any behavior to DataGridCell and then gain exclusive access over it and drill into its visual tree and perform any kind of performance improvements you want locally to its contents.
I have been using WPF datagrid for various requirements (hierarchical data display without row definitions and group styles, frequent data updates, large number of columns, frequent editable and validation based scenarios, adorning virtulaized cells and deferred scrolling with guesswork for scroll heuristics etc..)
You can play around with it to the fullest. Codeplex website has source code of last toolkit based WPF data grid available.
Let me know if this helps.
IF you need performance, your best option is to measure, measure, measure.
Build a quick prototype using each of the DataGrid classes you're looking at, using "realistic" sample data.
See which ones perform well, and which ones don't.
The Telerik RadGrid for WPF supports both Row- and Column-Virtualization and might be what you are looking for.
I'd not refuse a-priori a winform-approach since the huge amount of data and the relatively high speed of the updates. In a similar scenario, you may manage even much more data without affecting the performance significantly.
I'm a big fan of WPF, but not always it solve all the problems.

Displaying Tabular Data In A WinForm?

I started with using a TableLayoutPanel, but when I have big tables, they are extremely sluggish. I'm looking for the responsiveness of an HTML table to display my data in.
The only solution I currently have is to have my WinForm write and HTML table, and display it in an embedded browser. This obviously is a huge workaround, and I'd rather implement a more clean and straightforward solution.
If you have any suggestions, please fire away. (a ListView will not work for what I'm trying to do)
What about using a DataGridView, or if you have DevExpress, a XtraGridControl? TableLayoutPanel is designed for laying out controls as far as I know, not for presenting data.
On the other hand, if your data set grows as large that your tables become sluggish, you might want to narrow down your data, e.g. by filtering or by introducing paging, one page only displaying 50 items or so.
Paging as well as filtering, in turn, is supported at least by XtraGrid, not sure about Microsoft's DataGridView.
You definitely need either a grid or a report, depends on what you want.
Highly customizable grid controls (like Infragistics or DevExpress) allow you to make almost any appearance you need. Users will have no idea they look at grid control.

Where to start with building a blotter

I need to build a blotter using csharp and WPF. Basically, like an excel sheet but would have the capability of customizing backgrounds of each cell or setting the value of each cell. But not sure where to start.
If anybody build blotters in csharp or WPF, a few pointers on where to get started would be great. If you can suggest some good open source blotters that I can copy and enhance, that would also be great.
I cannot use standard data grids as they lack many of the capabilities I am looking for.
I know windows forms and applications related to that which have standard controls but to create cells that are editable/customizable like excel, not sure where to start....
Take a look at the Adaptable Blotter (www.adaptableblotter.com).
It includes all the functionality that you seek and works with a number of different WPF grid controls, both vendor and open source. There is a single set of screens giving you advanced search, flashing cells, bulk editing etc but with individual implementations for each underlying grid.
You can use a UniformGrid to create the Grid. You can put Textboxes or even more advanced UserControls into the cells.

alternative to DataGridView in Win API

Somewhere on net on one Blog I read a sentence that is "DataGridView something like Boeing 777, but what is goal when I do not know how to fly.
Before I goo deep in creating my projects I wanna know is there alternative for DataGridView in C#.
Something like jQuery in WEB api.
The favors things which I am looking for is that is simple for using, if its posibile to be freeware and looks smoth and modern.
Best regards
Admir
If you want to fly one person across town you can learn to fly a Piper Cub. If you want to fly hundreds across an ocean you need to learn to fly a 777.
There are many ways of displaying data in WinForms applications; which one is best for you depends on what you're trying to do. If you want to show a fixed, non-editable, non-scrollable list of data you can use a DataList; simple and limited. If you want to add scrolling you can output the data to a scrolling textbox.
If you want to handle a scrolling grid of multiple rows with multiple, resizable, editable columns you will need to move to a DataGrid or DataGridView.
There are many alternatives to DataGridViews; simpler controls provide fewer features and more functional controls are more complex.
I have implemented the datagridview extensively as an unbound control in a windows forms project using Visual Studio 2008. Looking back, implementing this control has consumed a large amount of time, mostly because it is loaded with bugs and peculiar behavior that should have been fixed rather than just 'documented'. A good data grid control is essential to any application of substance. I would recommend looking for a third party alternative from a company that is more interested in getting it right rather than just getting something out there.
The DataGridView is perfectly easy to use without going too deep. If all you want to do is display data in a grid, create a DataGridView and turn off features like adding and editing rows. The fact that it's got all of these incredibly complex features is really only an issue when you start needing to use them - and in that case, you'll be glad you're using it.
DevExpress has a really good gridview.

Categories

Resources