Skip to main content
Home Forums General Silverlight Getting Started large screen
8 replies. Latest Post by Jonathan Shen – MSFT on July 3, 2009.
(0)
mexican
Member
164 points
711 Posts
06-27-2009 9:02 AM |
I have a large grid which is larger than the screen.
Scrollbars dont appear so how do i set scrollbars to appear.
jay nana...
Contributor
3388 points
624 Posts
06-27-2009 10:42 AM |
<ScrollViewer HorizontalScrollBarVisibility="Auto"> <Grid x:Name="LayoutRoot" Background="Azure" Height="1028" Width="832" /></ScrollViewer>
rshelby
273 points
64 Posts
06-27-2009 10:44 AM |
I've gotten it to work by putting the grid inside the scrollviewer.
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<Grid x:Name="LayoutRoot" Background="Azure" Height="1028" Width="832" >
</ScrollViewer>
06-27-2009 10:46 AM |
Ah, it looks like jay got it before me!
06-28-2009 8:47 AM |
no this doesnt work as i cant scroll the whole 1000px
i can only see half of it
<ScrollViewer HorizontalScrollBarVisibility="Auto">
06-28-2009 10:29 AM |
If your UserControl size is auto, than try to restrict scorllviewer to some size say Width="800" Height="600". Than you can see whole.
06-28-2009 10:30 AM |
This code work for me.
<UserControl x:Class="Temp.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Grid Background="White"> <ScrollViewer HorizontalScrollBarVisibility="Auto" Width="800" Height="600" > <Grid x:Name="LayoutRoot" Background="Azure" Height="1028" Width="832" > <Grid.RowDefinitions> <RowDefinition Height="124"></RowDefinition> <RowDefinition Height="904"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="832"/> </Grid.ColumnDefinitions> <Canvas x:Name="canvas2" Grid.Column="0" Grid.Row="0" Height="128" Width="832" Background="Blue" > </Canvas> <Canvas x:Name="canvas1" Grid.Column="0" Grid.Row="1" Height="904" Width="832" Background="Aqua" > </Canvas> </Grid> </ScrollViewer> </Grid></UserControl>
06-28-2009 8:18 PM |
<UserControl x:Class="mathtrainer2.Page"
<
if i remove the line below it works fine and the SL app is centred? why?
Height="1028" Width="832">
Jonathan...
All-Star
23562 points
2,304 Posts
07-03-2009 5:33 AM |
Hi Mexican,
When we remove Height and Width property from the UserControl and set the Silverlight's Width and Height property to "100%". For example,
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/ScrollViewerTest.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%"/>
Silverlight view area's width property will equal to its container's width value. That's why it will seemed to be centered. You can expand its width property from 832 to 1200. Then you will get the clues.
Best regards,
Jonathan