locked
How to make background stay the same at different resolution RRS feed

  • Question

  • I have a image, its size is 136*100.

    And I have some codes as following:

    <ImageBrush ImageSource="ms-appx:///Assets/picture/bg_cliplist.png" Stretch="Fill"/>

    Then it has one problem is that:

    It works well in the 1920*1080, but it works bad in 1366*768.

    How can I make the background still the same view in different resolution?

    Wednesday, September 4, 2013 3:08 AM

Answers

  • You don't say what you mean by 'it works bad'. Is it getting blocky? Stretched out of proportion?

    Most likely, just change the value of the Stretch property (e.g. Uniform, UniformToFill, or one of the other values) until it matches what you want it to behave like.


    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

    • Marked as answer by Shirley-cheng Wednesday, September 4, 2013 9:03 AM
    Wednesday, September 4, 2013 5:16 AM

All replies

  • You don't say what you mean by 'it works bad'. Is it getting blocky? Stretched out of proportion?

    Most likely, just change the value of the Stretch property (e.g. Uniform, UniformToFill, or one of the other values) until it matches what you want it to behave like.


    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

    • Marked as answer by Shirley-cheng Wednesday, September 4, 2013 9:03 AM
    Wednesday, September 4, 2013 5:16 AM
  • Hello Shirley, 

    You can use Viewbox control. This control is very useful in your question. Show this link:

    show this thread for example

    I hope this is work in your case.

    Wednesday, September 4, 2013 5:19 AM
  • <Grid.Background>
          <ImageBrush ImageSource="ms-appx:///Assets/picture/bg_cliplist.png" Stretch="Fill"/>
    </Grid.Background>

    Above is the whole code.

    I have tried the value of the Stretch property as Uniform and UniformToFill, but it doesn't work still.

    'it works bad' means that the background will goto the following state.

    Wednesday, September 4, 2013 5:51 AM
  • But the right state shoule be :

    The right state

    Wednesday, September 4, 2013 5:52 AM
  • So you put grid inside viewbox:

    <Viewbox Stretch="Fill" StretchDirection="UpOnly">
            <Grid Height="768" Width="1024">
                <Grid.Background>
      <ImageBrush ImageSource="ms-appx:///Assets/picture/bg_cliplist.png"/>
                </Grid.Background>
    	 </Grid>
    </Viewbox>

    Wednesday, September 4, 2013 6:06 AM
  • I have resolved this question.

    The method is that I set the value of Stretch property as None, then it works!

    Wednesday, September 4, 2013 7:08 AM