Put Canvas into ScrollViewer : ScrollViewer « Windows Presentation Foundation « C# / C Sharp






Put Canvas into ScrollViewer

    

<Window x:Class="SimpleStyles.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="SimpleStyles"
  Background="#F8F8F8">
  <ScrollViewer>
    <WrapPanel>
      <HeaderedItemsControl Header="ScrollViewer">
        <StackPanel>
          <ScrollViewer Width="200" Height="200" Style="{StaticResource LeftScrollViewer}">
            <Canvas Width="400" Height="400">
              <Canvas.Background>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                  <GradientStop Color="#FFF" Offset="0"/>
                  <GradientStop Color="#AAA" Offset="1"/>
                </LinearGradientBrush>
              </Canvas.Background>
            </Canvas>
          </ScrollViewer>
        </StackPanel>
      </HeaderedItemsControl>
   
    </WrapPanel>
  </ScrollViewer>
</Window>

   
    
    
    
  








Related examples in the same category

1.Default Thumb StyleDefault Thumb Style
2.StackPanel in a ScrollViewerStackPanel in a ScrollViewer
3.ScrollViewer and Big EllipseScrollViewer and Big Ellipse
4.Use the content-scrolling methods of the ScrollViewer classUse the content-scrolling methods of the ScrollViewer class