Skip to main content

Microsoft Silverlight

Answered Question large screenRSS Feed

(0)

mexican
mexican

Member

Member

164 points

711 Posts

large screen

I have a large grid which is larger than the screen.

Scrollbars dont appear so how do i set scrollbars to appear.

i have done this before i am sure

<Grid x:Name="LayoutRoot" Background="Azure" Height="1028" Width="832" >

jay nanavati
jay nana...

Contributor

Contributor

3388 points

624 Posts

Re: large screen

<ScrollViewer HorizontalScrollBarVisibility="Auto">
        <Grid x:Name="LayoutRoot" Background="Azure" Height="1028" Width="832" />
</ScrollViewer>

Jay K Nanavaty
www.technologyopinion.com
Mark as answer if it helps. It will also help others...

rshelby
rshelby

Member

Member

273 points

64 Posts

Re: large screen

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>

rshelby

Ryan Shelby

rshelby.com

rshelby
rshelby

Member

Member

273 points

64 Posts

Re: large screen

Ah, it looks like jay got it before me! Smile

Ryan Shelby

rshelby.com

mexican
mexican

Member

Member

164 points

711 Posts

Re: large screen

no this doesnt work as i cant scroll the whole 1000px

i can only see half of it 

<ScrollViewer HorizontalScrollBarVisibility="Auto">

<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>

jay nanavati
jay nana...

Contributor

Contributor

3388 points

624 Posts

Re: Re: large screen

If your UserControl size is auto, than try to restrict scorllviewer to some size say  Width="800" Height="600". Than you can see whole.

Jay K Nanavaty
www.technologyopinion.com
Mark as answer if it helps. It will also help others...

jay nanavati
jay nana...

Contributor

Contributor

3388 points

624 Posts

Answered Question

Re: Re: Re: large screen

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>
 

Jay K Nanavaty
www.technologyopinion.com
Mark as answer if it helps. It will also help others...

mexican
mexican

Member

Member

164 points

711 Posts

Re: Re: Re: large screen

<UserControl x:Class="mathtrainer2.Page"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

>

if i remove the line below it works fine and the SL app is centred? why? 

Height="1028" Width="832">

Jonathan Shen – MSFT
Jonathan...

All-Star

All-Star

23562 points

2,304 Posts

Microsoft

Re: Re: Re: large screen

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

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities