1

In this code I added an image before the button text I'd like to have a space between the image and text but the code I have isn't working.

  <Button Height="25" 
          Width="80" 
          Margin="5,10,5,10"
          Command="{Binding PreviewTemplateCommand}">
          <StackPanel Orientation="Horizontal" Height="15" Width="63">
              <Image Source="/UILibrary;component/Themes/Default/Images/preview.PNG" 
                     Height="15" Width="15" Margin="0,0,0,0" />
              <TextBlock >Preview</TextBlock>
          </StackPanel>
  </Button>
1
  • You say "some space between button and image" - do you mean to add space between the text and the image or between the edges of the button and the image?
    – Tim
    May 26, 2015 at 20:26

1 Answer 1

2

Hi you have to set the left margin of the textblock. Try this:

 <StackPanel Orientation="Horizontal" Height="15" Width="63">
                <Image Source="..." Height="15" Width="15" Margin="0,0,0,0" />
                <TextBlock Margin="25,0,0,0">Preview</TextBlock>
 </StackPanel>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.