BitmapIcon
BitmapIcon
enables you to use an image file as the source of your icon. Although this is the only type of IconElement
that is not vector-based, it does two things to make the image almost as good as vector art:
→ It automatically scales the image to fit inside the circle
→ It respects transparency and replaces all non-transparent pixels with the appropriate Foreground
brush (as long as Foreground
is a solid color)
Figure 9.8 demonstrates using the app’s large splash screen image as the icon for three AppBarButton
s with the following XAML, which varies the Foreground
to demonstrate the special treatment of the image content:
<AppBarButton Label="Default Foreground"> <AppBarButton.Icon> < BitmapIcon ...
Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.