XAML Code Icons — Export Paths for WPF & WinUI

Export vector icons as XAML Path data and drop them into WPF or WinUI. You’ll learn how to theme with brushes, bind to Foreground, add accessibility via AutomationProperties, and package icons as reusable resources.

When to choose XAML code

Draw, Import or Trace your icon

Draw your icon illustration

Export XAML from IconVectors

  1. Design on a consistent grid (e.g., 24×24). Keep strokes aligned to whole pixels.
  2. Set theming strategy: for single‑color icons, you’ll typically bind Fill or Stroke to a brush (see below).
  3. Open the Live Code Viewer (F3) and switch to the XAML tab.
  4. Copy the generated XAML Path (or Export) and paste it into your app as shown next.

WPF: simple Path bound to Foreground

<Grid>
  <Grid.Resources>
    <Style x:Key="IconPathStyle" TargetType="Path">
      <Setter Property="Stretch" Value="Uniform"/>
      <Setter Property="Fill" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType=Control}}"/>
      <Setter Property="SnapsToDevicePixels" Value="True"/>
    </Style>
  </Grid.Resources>

  <Button Padding="8">
    <Path Style="{StaticResource IconPathStyle}"
          Width="24" Height="24"
          Data="M2.5 9C2.5 2.5 10 3 12 7.5C14 3 21.5 2.5 21.5 9C21.5 15.4 12 21.5 12 21.5C12 21.5 2.5 15.6 2.5 9z"
          AutomationProperties.Name="Favorite"/>
    <Button.Content>Favorite</Button.Content>
  </Button>
</Grid>

WPF: package as a reusable resource (Geometry)

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <SolidColorBrush x:Key="IconBrush" Color="#2563EB"/>
  <Geometry x:Key="Heart24Geometry">M2.5 9C2.5 2.5 10 3 12 7.5C14 3 21.5 2.5 21.5 9C21.5 15.4 12 21.5 12 21.5C12 21.5 2.5 15.6 2.5 9z</Geometry>
</ResourceDictionary>
<Path Data="{StaticResource Heart24Geometry}"
      Width="24" Height="24"
      Stretch="Uniform"
      Fill="{DynamicResource IconBrush}"
      AutomationProperties.Name="Favorite"/>

WinUI: PathIcon with themeable brush

<Page.Resources>
  <SolidColorBrush x:Key="IconBrush" Color="{ThemeResource SystemAccentColor}" />
</Page.Resources>

<StackPanel Orientation="Horizontal" Spacing="8">
  <PathIcon Data="M2.5 9C2.5 2.5 10 3 12 7.5C14 3 21.5 2.5 21.5 9C21.5 15.4 12 21.5 12 21.5C12 21.5 2.5 15.6 2.5 9z"
            Foreground="{StaticResource IconBrush}"
            Width="24" Height="24"
            AutomationProperties.Name="Favorite"/>
  <TextBlock Text="Favorite"/>
</StackPanel>

Accessibility checklist

Theming options (brushes & bindings)

Performance & packaging tips

Reference example (XAML Path)

<Path Width="24" Height="24" Stretch="Uniform"
      StrokeThickness="1" StrokeLineJoin="Round" StrokeStartLineCap="Round" StrokeEndLineCap="Round"
      Data="M2.5 9C2.5 2.5 10 3 12 7.5C14 3 21.5 2.5 21.5 9C21.5 15.4 12 21.5 12 21.5C12 21.5 2.5 15.6 2.5 9z"
      Fill="{DynamicResource IconBrush}"
      AutomationProperties.Name="Favorite"/>

Start Making SVG Icons Today with IconVectors

Download the fully-functional 30‑Day Free Trial and unlock your icon design workflow.

Version 1.10 - September 17, 2025