Sharker Khaleed Mahmud Silverlight Tips & Tricks

January 4, 2010

Tricks and Tips 7 : How do i apply ScrollViewer in Silverlight

Applying Scrollviewer is very simple in silverlight. The logic is that the content has to be more than the default height given for the scrollviewer for it to work.

MainPage.xaml

<UserControl x:Class=”Tips.MainPage”
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml
    xmlns:d=”http://schemas.microsoft.com/expression/blend/2008
    xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006
    mc:Ignorable=”d”
    d:DesignHeight=”300″ d:DesignWidth=”400″>
    <Grid x:Name=”LayoutRoot” Background=”White”>
        <ScrollViewer Width=”200″ Height=”200″>
            <Canvas Background=”Beige” Height=”400″></Canvas>
        </ScrollViewer>
    </Grid>
</UserControl>

Sharker Khaleed Mahmud
Software Developer
(MCP,MCTS,MCPD[web])

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.