Transform any vector format to XAML (DrawingBrush or VisualBrush)

  1. Get InkScape, it’s free!
  2. Export you vector format to XAML to a file: exported.xaml
  3. Go to Microsoft Blend (part of Visual Studio). It was called Expression Blend before VS 2012.
  4. Create a test project (WPF Project, for example) that supports XAML
  5. Open the exported file in XAML and a text editor. Copy the code.
  6. Go back to Blend and in a blank Window (the default Window that is created, for example) and paste the code inside a Panel (like <Grid></Grid>). You will paste a <ViewBox> with lots of things inside.
  7. Your vector graphic appears in the Design screen. Click it.
  8. Choose the menu Tools->Make Brush Resource. Choose VisualBrush or DrawingBrush (I normally select DrawingBrush).
  9. Go the the Resources tab and you will see the new resource that has been created
  10. Copy the code of the resource clicking it, then “View Source”.
  11. Paste it in your project! (a Resource Dictionary should be a good idea!).

Enjoy😀

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s