views:

1495

answers:

1

I have the following simple button with an image as the template. The problem is that I want to change the image to a resource, instead of a content reference. I want to do this so I can share the DLL as a re-usable library, and it doesn't work well when I do that.

How do I tell the Image object to use an embedded resource in a declarative way?

<Button x:Name="LogoutButton" Click="Button_Click">
  <Button.Template>
    <ControlTemplate>
      <Image Source="Resources/logout.png" />
    </ControlTemplate>
  </Button.Template>
</Button>
+2  A: 

Ok, I figured it out:

  1. Don't make it an embedded resource. Make it a Resource/Do Not Copy

That is all there is to it. Reference it like you would a content path, and it works.

Brian Genisio