I have an image (a frame) and a rectangle (the picture inside the frame). I made them fit each other, and I can change the rectangle's filling image from code, like this:
myRectangle.Fill = new ImageBrush(new BitmapImage(new Uri(myImagePath)));
But I had to made this two object for one button, so I selected them in Expression Blend, right click and click on "Make Into Control" and select "Button" then click ok then I got a button. The only problem is I can't fill the rectangle, because I don't know how to reach it from code.
Is there anyone who can tell me how to reach my rectangle from code inside the button, and fill it with an image?
If you know the name of the control e.g. Button you should be able to find it in code-behind as shown below
var myRectangleButton = (Button)this.FindName("myRectangleButton");