Key Implementation Considerations for Improving UI Performance in XAML for Windows Embedded Applications (Compact 2013)
3/26/2014
Load time can be significantly improved in XAML for Windows Embedded, mainly by modifications to compilation of BAML and PNG files for loading graphic or photographic images. BAML files are smaller and faster to read than the original XAML files, which lowers load time. The following practices can increase the gain of these improvements:
- Load image assets from resource binaries.
- Create controls for self-contained elements; invoke controls only when necessary. Examples include History/Favorites, Zoom options panel and status bar elements.
- Use images instead of controls when possible. Check whether buttons can be represented with images and whether to use stack panels or list boxes.
- Use images instead of paths when possible; use a minimal number of precision points in paths.
- Replace storyboard elements with visual states.
- Share styles when appropriate. For example, if you want all buttons in your design to look the same, you can define a button style and apply it to all of the buttons.
- Prune unnecessary visual state groups and empty or default values out of the XAML. Examples are: <Storyboard/> and Stretch="Fill".
- Design for minimal use of screen real estate. For example, use visibility = collapsed instead of opacity = 0.
- Specify target types for styles and for control templates that are inside resources.
Animation speed is made faster in XAML for Windows Embedded by automatically invoking cached composition. The most effective way to improve animation is to use faster hardware or to use a less complex UI. Some other effective ways to improve animation are:
- Limit large-scale animations to use transformations that can be hardware accelerated. For example, use a translation transformation, rather than modifying x and y positions of an object.
- Structure the XAML to improve buffer usage.
Windows Embedded Compact Test Kit (CTK) includes sample performance tests to help you analyze how applications perform on your hardware platforms. These samples can help you determine how to maximize performance of your UI.
See Also
Tasks
Optimize UI Elements and XAML Files for Graphics Performance