开发者

WPF : display large amount of custom controls

开发者 https://www.devze.com 2023-04-11 10:58 出处:网络
I\'m about to develop a wpf app which will be used as a planning tool. The main idea is to display a table, rows are people, columns are days. Each cell is split into two smaller cells, each smaller c

I'm about to develop a wpf app which will be used as a planning tool. The main idea is to display a table, rows are people, columns are days. Each cell is split into two smaller cells, each smaller cell corresponds to a task assigned to the employee (the row) for the day (the column).

Should look like this :

///////////// Day 1//Day 2//Day 3//Day 4//Day 5//Day 6//Day 7

People1 E1/E2 E1/E2 E1/E2 E1/E2 E1/E2 E1/E2 E1/E2

People2 E1/E2 E1/E2 E1/E2 E1/E2 E1/E2 E1/E2 E1/E2

People3 E1/E2 E1/E2 E1/E2 E1/E2 E1/E2 E1/E2 E1/E2

I need to be able to use a customcontrol as one smaller cell (one "开发者_如何转开发task").

I tried to manipulate ItemsControl, DataGrid, but everytime it was showing performance issues : either the scrolling (both horizontally and vertically) was laggy, or the time used by the app to draw the components was way too important.

As I seem to need new ideas to solve the performance issue, I was wondering if maybe someone else have had the same problem, and managed to deal with it..

Any suggestion?


ItemsControl is known to have performance problems. You can try to switch to ListBox or ListView because they are based on a VirtualizingStackPanel.

Also, the question WPF - Virtualizing an ItemsControl? has more information about virtualizing an ItemsControl.

Furthermore, it was announced at the recent Build conference that .NET 4.5 will contain considerable performance improvements to ItemsControl. Ira Lukhezo sums it up in a blog entry titled ItemsControl Performance Improvements in .NET 4.5.


OK if you are using DataGrid then check if ListView gives better results.

OR

I hope you are using DataGrid with DataGridTemplateColumns, if so then show the Functional Graphical E1/E2 in CellEditingTemplate and a snapshot Drawing of E1/E2 in Celltemplate. They both will look the same but Drawing based one will perform better as the Drawing is Freezable while rendering.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号