Put an image inside a Button RRS feed

  • Question

  • Hi

    I am new to Blend and I want to display an Image inside a Button on my Window,and when the user maximizes the window I want the button(which contain the image) to remain in the same size and on the same position

    Any help please?

    Wednesday, April 30, 2008 8:23 AM

All replies

  • cuterita7,

    Before we touch on the image in a button, I want to make sure I understand your goal with the positioning. 

    Do you want the button, for example, to remain in the center of the window regardless of the window size?  Or do you want the button to always be a fixed number of pixels from the left and top edge of the window? 

    In Expression Blend there are a number of layout containers (Grid, Canvas, StackPanel, WrapPanel, etc.) that have an effect on object placement.  To learn more about the different layout containers, go to Help > User Guide or press F1 to bring up the User Guide and search for layout container.

    As for the image in a button, here's an easy way to do that:

    1.  Once you have your button, go to Project > Add Existing Item or press Ctrl+I
    2.  Add the image file you want in your button
    3.  In the Objects and Timeline tree, expand the objects until you see your button
    4.  Double-click the button in the Objects and Timeline tree so that it is has a yellow border around it
    5.  Right click the image in the list of files under the Project tab and select Insert
    6.  The image is now nested inside the button and you're ready to go!

    Best regards,

    Jonathan - MSFT

    This posting is provided "AS IS" with no warranties and confers no rights
    Wednesday, April 30, 2008 8:41 PM