Number of 10 ways to improve WPF application performance November 16, 2010 00:05 it168 website Original author: IT168 Huangyongbing Edit: Huminya Comments: 0 article Tag:ASP.NET WPF. NET
"IT168" WPF (Windows presentation Foundation) applications running slowly on a machine without a graphics accelerator is an open secret, giving the user the impression that it is eating too much, and that the performance and hardware of the WPF program really has a lot to do with it. The more upscale the machine performance the more advantages.
Program performance improvements are not done overnight, and good design eliminates problems that affect performance, for example, building objects at run time can have an impact on program performance. Although WPF provides a richer user interface with features such as enhanced navigation, but you should consider whether your users really need a rich graphical interface, although WPF has such a problem, but it does give developers a lot of flexibility in UI design, especially custom styling and control templates.
Figure 1 WPF schema, Blue is a Windows component, and Brown is a WPF component
The main factor in rendering a WPF program is the amount of pixels it contains, and WPF uses Microsoft's DirectX to render the program's running hardware, so if your machine has a stand-alone video card, running the WPF program will be smoother. In addition to improving the hardware configuration, let's look at 10 soft ways to improve the performance of WPF programs.
1, reduce bitmapscalingmode, accelerate image rendering
When you include animations in your WPF program, you can use the Bitmapscalingmode property of the Renderoptions object to reduce resource consumption, and you need to set the value of the Bitmapscalingmode property to Lowquality. This will use the acceleration algorithm to process the image instead of the default high quality image resampling algorithm. The following code fragment shows the most basic implementation methods: