locked
Displaying images with respect to the screen resolutions RRS feed

  • Question

  • In my windows 8 app we are using WCF service to fetch the data, in the app images are displaying with the image urls like "http://mysite.com/images/sample.png".

    In the xaml i am using image tag to display the image like this. 

    <Image Margin="0"  Source="http://mysite.com/images/sample.png" Height="100" Stretch="UniformToFill"   HorizontalAlignment="Left"   VerticalAlignment="Top"  Style="{StaticResource ImageFadeInStyle}"/>

    i want to display the image in such a way that if resolution changes i want another image to be displayed. can you please suggest any ideas.

    thanks in advance.


    suresh

    Monday, February 17, 2014 3:36 PM

Answers

  • You'll need to swap the image from code. I'd data bind to an image serving class which can monitor for resolution changes and pick the appropriate URI for the image.

    If the images were local you would append resolutions to the name for different versions.

    Also see http://msdn.microsoft.com/en-us/library/windows/apps/dn297195.aspx for how to swap your Xaml for different screen sizes, but I don't think that's quite what you are looking for here.

    Monday, February 17, 2014 3:53 PM
    Moderator

All replies

  • What language are you using so we can get you to an appropriate forum?
    Monday, February 17, 2014 3:42 PM
    Moderator
  • c#, xaml for displaying purpose

    suresh

    Monday, February 17, 2014 3:48 PM
  • You'll need to swap the image from code. I'd data bind to an image serving class which can monitor for resolution changes and pick the appropriate URI for the image.

    If the images were local you would append resolutions to the name for different versions.

    Also see http://msdn.microsoft.com/en-us/library/windows/apps/dn297195.aspx for how to swap your Xaml for different screen sizes, but I don't think that's quite what you are looking for here.

    Monday, February 17, 2014 3:53 PM
    Moderator