Hi,
Can any body please provide me, how can we made custom template for the ScrollViewer.
Pointers to any simple tutorials will be greatly appreciated. Thanks, -Narendra
Hi,
Can any body please provide me, how can we made custom template for the ScrollViewer.
Pointers to any simple tutorials will be greatly appreciated. Thanks, -Narendra
First thing to do is get yourself a copy of the existing ScrollViewer template. Blend makes that very easy. In VS you have more work to do. Lets start with a base UserControl
<UserControl ....>
<Grid x:Name="LayoutRoot">
<ScrollViewer ...>
<!-- Content here -->
</ScrollViewer>
</Grid>
</UserControl>
Got the documentation ScrollViewer Styles and Templates you'll find the existing xaml for this control here. Copy it and place it in the UserControl
resources.
<UserControl ....>
<UserControl.Resources>
<Style x:Key="MyScrollViewerStyle" TargetType="ScrollViewer">
<!-- copied content of the style from the above link -->
</Style>
</UserControl.Resources>
<Grid ....>
<Grid x:Name="LayoutRoot">
<ScrollViewer Style="{StaticResource MyScrollViewerStyle}">
<!-- Content here -->
</ScrollViewer>
Now the ScrollViewer looks identical to what you had before. The difference is you can now start playing around with the Template
Setter
in the style to re-arrange and customise the ScrollViewer
.
Or build on existing Silverlight themes: http://timheuer.com/blog/archive/2010/05/03/new-silverlight-4-themes-available-for-download.aspx