I'm working on a flipview to recreate something exactly like photos app. I'm facing problem when restricting the scroll area(pan area) like I would not like the user to zoom/scroll in the dark area where the image is not present. I can do this by inserting a stackpanel but have to specify its height and width as the width of the image. But I'm not able to set this as I can't get the proper height,width details of the image.
Code:
<ScrollViewer x:Name="theScrollViewer"
ViewChanged="theScrollViewer_ViewChanged"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
ZoomMode="Enabled" MinZoomFactor="1" MaxZoomFactor="2"
SizeChanged="OnSizeChanged">
<StackPanel Orientation="Horizontal">
<Image x:Name="theImage"
Stretch="Uniform" Source="Assets/2222.png" />
</StackPanel>
</ScrollViewer>
Can anyone help me out here how to exactly do this? Or any alternatives.
Edit: Its not helping to set the stackpanel height and width dynamically to the scaled version of the image height & width got by ImageProperties . Is there any alternatives