6

I want to load 10 000 items in a DataGrid in WPF. When using a Window control the data loads faster than when using a Page control. Can someone explain why?

Claudiu Constantin
  • 2,138
  • 27
  • 38
Nadeem
  • 651
  • 1
  • 13
  • 26
  • why don't you create a simple test? – Jake Berger Mar 01 '12 at 18:13
  • I recon you could use a profiling tool (dotTrace or ANTS) to see whats happening and what is causing the difference. – pguzewicz Mar 01 '12 at 19:57
  • Do you need to edit or add? If not you are going to get better performance with a ListView GridView. I would review the code and see if there is not something different. – paparazzo Mar 04 '12 at 20:49
  • What is your page hosted in? Could be due to WPF trying to figure out grid / column sizing. Are you columns auto gen'd? If defined, are Column sizes specified? – KornMuffin Mar 06 '12 at 15:58

1 Answers1

2

Pages are intended for use in Navigation applications (usually with Back and Forward buttons, e.g. Internet Explorer). Pages must be hosted in a NavigationWindow or a Frame

Windows are just normal WPF application Windows [lnk]

This is essentially an XBAP vs ClickOnce problem. Anything in a Page is compiled for and restricted by what WPF is permitted to do in a browser window. This precludes many low level computer operations that WPF Windows can get away with because they are compiled to run from the desktop. Window apps have full access to system resources.

Keep in mind that when you use a Page control, even during debugging, the generated code is build with a browser deployment in mind. All XBAPs are run in a restrictive security sandbox under partial trust. In other words, they are allowed to use certain .NET libraries but banned from accessing others. [ref] Some of these .NET libraries will be responsible for optimizations that therefore can't achieved in a browser deployment.

As such, it makes perfect sense that applications build in Windows would be able to perform most operations faster than apps built in Pages.

Community
  • 1
  • 1
Alain
  • 26,663
  • 20
  • 114
  • 184