tags:

views:

228

answers:

2

Hi All

I'm learning WPF at the moment.

I have a vector graphics canvas that I'd like to use as the background for a button, but I can't seem to find a way to do this in the documentation. I thought this would be an obvious thing to want to do.

Regards, Mark

+1  A: 

Apologies,

I think I've found the solution. DrawingBrush.

Thanks, Mark

Mark
yes, that's probably more adequate than my own answer...
Thomas Levesque
+1  A: 

You can use a VisualBrush :

<Button Content="Hello">
    <Button.Background>
        <VisualBrush>
            <VisualBrush.Visual>
                <!-- Your vector graphics here -->
            </VisualBrush.Visual>
        </VisualBrush>
    </Button.Background>
</Button>
Thomas Levesque
Thanks Thomas. DrawingBrush didn't work - I have a canvas in a resource, and it didn't seem to like a canvas, whereas a VisualBrush does.
Mark