Search code examples
windows-8windows-runtimemicrosoft-metrowindows-store-appsviewbox

How to create scrollable canvas in WinRT?


I tried this, but I can't scroll the canvas. I tried to handle mousewheel change event of other controls but scrolling is not working. Anybody has idea what I am doing wrong ?

<Viewbox Stretch="Fill" StretchDirection="Both" Height="300" Width="300">
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollMode="Enabled"
      ScrollViewer.VerticalScrollBarVisibility="Disabled" Margin="20,0,20,0" Height="300" Width="300">
    <Canvas Background="White" Height="300" Width="500">
        <TextBlock FontSize="20" Text="This Is Far Right" Canvas.Left="350" Foreground="Black" />
    </Canvas>
</ScrollViewer>
</Viewbox>

Solution

  • ScrollViewer.VerticalScrollMode="Disabled" solved my problem.