xaml - Resize image from url for panorama background -


i'm working on first wp7 app , i'm exploring world of panorama control. i've loaded object rest service , i've set background of panorama image url in object.

var brush = new imagebrush() { imagesource = new bitmapimage(new uri(_group.photo_url, urikind.absolute)) }; grouppanorama.background = brush; 

the problem have image arbitrary size on server , case ends being squished (horizontally) , tiled without filling width of screen horizontally.

i'm assuming need re-size dimensions control supports, not sure how go this. assume pretty common task.

many thanks!

edit:

including snip-it of xaml. pretty generic:

<!--layoutroot contains root grid other page content placed--> <grid x:name="layoutroot">     <controls:panorama name="grouppanorama" title="" selectionchanged="grouppanorama_selectionchanged">          <!--panorama item one-->         <controls:panoramaitem header="main">             <grid/>         </controls:panoramaitem> 

i guess should note have tried various stretch properties imagebrush no luck.

update:
appears work normal size images. image attempting pretty small , doesn't appear stretch. perhaps it's bug, i'll work around now.

as previous answer suggests, can use stretch property of imagebrush framework resizing you. elaborate:

  • stretch.fill: option resize image horizontally , vertically fit required space, result in image being squashed or stretched in either or both directions.
  • stretch.uniform: option resize image horizontally or vertically depending on source image, while maintaining aspect ratio of image. still possible have empty space if use option.
  • stretch.uniformtofill: previous option, option maintains aspect ratio of image, ensures available space filled. prevent empty space, part of image may cropped.

you need make choice based on requirements (personally think uniformtofill best suited in situation) , typical dimensions of source images.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -