Freigeben über


Creating Round Image Button for WP7 (part 3)

In my previous post I described a programmatic way to change an icon for the Round Image button (or any other control for that matter) in your WP7 application by creating the ThemedImageConverter class. However, if you are able to create a XAML vector type of an image you don't need to have to create converter. 

The download for 64 standard application bar icons besides ".PNG" files also contains (vector) Adove Illustrator file basic_shellcommon_vectors.ai which you can import into Blend. After Blend imports this file you'd get a XAML for all icons. You can just copy the Path corresponding to the icon you want to use into your button like so:

 <Button  VerticalAlignment="Top" Style="{StaticResource RoundButton}" Height="68" Width="68" Margin="174,221,238,0" Click="Button_Click">
      <Path Data="F1M534.0898,314.6377L526.7168,321.5927L532.7128,321.5927L542.5758,312.2857L532.7558,303.0227L526.7618,303.0227L534.0898,309.9367L517.4628,309.9367L517.4628,314.6377z" 
        Fill="{StaticResource PhoneForegroundBrush}" Height="18.57" Canvas.Left="489.103" Stretch="Fill" Canvas.Top="276.883" Width="25.113"/>
</Button

You can see that I've assigned the PhoneForegroundBrush to the Fill property of the Path which will take care of changing the color of an icon automatically.

Enjoy...