c# - How to Center Image in ViewBox -
i populating viewbox image, although cannot seem center on image. i've tried setting viewbox fill uniformtofill, centering image vertically , horizontally, etc , nothing seems work.
xaml
<stackpanel horizontalalignment="center" verticalalignment="center"> <viewbox maxwidth="500" maxheight="500" name="vb1"> <image x:name="myimage"/> </viewbox> </stackpanel>
xaml.cs
bitmapimage bitimg = new bitmapimage(new uri("/mynewlink.jpg", urikind.relative)); myimage.source = bitimg imagesource;
set verticalalignment , horizontalalignment of viewbox. have set content alignment of image.
Comments
Post a Comment