Duncan Groenewald
Duncan Groenewald

Reputation: 9018

How to combined multiple PATH objects into a vector image that can be used as a style in WPF/XAML

I have a complex logo developed in Illustrator that I want to use as an image in WPF. I can seem to combine the Path's when importing into Blend to get a single Path without loosing all the fill colours.

What is the best way to convert the illustrator image into something that can be used in WPF/XAML.

Usually i just combine the Path's into a single Path and then reference the path using the following:

<Application.Resources>
   <Path x:Key="pathKeyName" Data="..."/>

</Application.Resources>


<Path Style="{StaticResource pathKeyName}" />

However there seems to be no easy way to group multiple paths together into a single image that can be used as a resource in a similar manner.

Perhaps there is a way to convert these paths into a Geometry ?

EDIT In the meantime I have used Blend to create a UserControl from the selected paths and then I place this control inside a Viewbox - not quite as simple but it seems to work.

Upvotes: 4

Views: 1395

Answers (1)

Chris W.
Chris W.

Reputation: 23290

No sweat, go grab yourself Mike Swanson's AI to XAML exporter plugin for Illustrator (dont pay attention to the versions mentioned on there, it works just fine with the newest version I use it all the time) and export your logo to XAML for WPF.

Then take that XAML and plop it in a ContentControl like I show how on a previous SO answer post.

Then you plop that Style Template into your resource dictionary or wherever and reference it as such with one line wherever/however you need it, voila. :)

Hope this helps, cheers.

OH PS, if there's a lot of shapes/colors etc, you'll never get it into just one Path, sorry amigo.

Upvotes: 1

Related Questions