locked
Combine multiple Brushes to one RRS feed

  • Question

  • Hi,

    an app uses a background which is composed from a background color, a linar gradient and two radial gradient (looks better that it sounds :). Since this background is used on all pages I would look to define it once and than re-use it on all pages.

    My first solution was to create a UserControl and apply the color and the gradient on it. I can then use this control on all pages as background.

    This works fine but I wonder if there is a more elegant solution. Is it somehow possible to combine multiple brushes to one? I could then simply Apple "MyCombinedBrush" to the page directly instead of using an extra UserControl.

    Tuesday, November 5, 2013 9:23 AM

All replies

  • You can paint your brush into a bitmap and then create an ImageBrush from it.

    --Rob

    Wednesday, November 6, 2013 5:57 AM
  • Hi Rob,

    thank you for your answer. Can this be done in XAML? I have no idea how I would "paint the brush into a bitmap"...

    I tried to create an Image in XAML and add my "drawings" (background, gradient, etc.) to it but this did not work out.

    All I found about Bitmaps and XAML refered to WPF and would not work on WP.

    Thursday, November 7, 2013 11:06 AM
  • Hi,

    I still found no information on how to do this. Does anyone know a good tutorial?

    Sunday, November 10, 2013 1:23 PM
  • You will have to do this in code, not in Xaml. I have no idea what you want this to look like so I can't provide specific help, but I'd probably start with a WriteableBitmap.

    --Rob

    Friday, November 15, 2013 3:23 AM