O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Binary Resources in WPF

Whether binary resources are added to a Visual Studio project with the Resource build action, linked as loose files with the Content build action, or left as loose files that are not added to the project at all, WPF provides a mechanism for accessing them from code or XAML with a uniform resource identifier (URI). A type converter enables such URIs to be specified in XAML as simple strings with a few built-in shortcuts for common scenarios.

Here’s a simple example of referencing images included in the project:

<StackPanel Orientation="Horizontal">  <Button x:Name="previousButton" ToolTip="Previous (Left Arrow)" ...>    <Image Height="21" Source="previous.gif" />  </Button>  <Button x:Name ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required