c# - Fill ViewBox completely with part of image area determined by Image.Clip -
i have large image want use within windows phone 8.1 app. purpose of application want show part of image , want fill complete viewbox specific part.
i can specific part of image using image.clip. until have been unable viewbox filled part determined image.clip. use following xaml.
<pivot> <pivotitem margin="10"> <viewbox stretch="uniform" stretchdirection="both"> <image source="http://image.png" stretch="none"> <image.clip> <rectanglegeometry rect="500,100,600,700"/> </image.clip> </image> </viewbox> </pivotitem> </pivot>
i've tried various combinations of stretch settings on both image , viewbox. i'also experimented scaletransforms until no luck.
so question is want possible within xaml , if combination of xaml code should use?
you may fill fixed size rectangle translated imagebrush this:
<viewbox stretch="uniform" stretchdirection="both"> <rectangle width="600" height="700"> <rectangle.fill> <imagebrush imagesource="http://image.png" stretch="none" alignmentx="left" alignmenty="top"> <imagebrush.transform> <translatetransform x="-500" y="-100"/> </imagebrush.transform> </imagebrush> </rectangle.fill> </rectangle> </viewbox>
Comments
Post a Comment