Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am new to windows mobile development.

I am in a task in which i need to put 18 images in a page . I am using grid view for that .I created 9 row definitions for that task.But i am unable to add images to each block and get the output as scrollview. I put a scrollview for the grid.

Now,i need to get the output as a scrolling page. I'm posting the code

XML
<Grid Height="577" HorizontalAlignment="Left" Margin="24,30,0,0" Name="grid1" VerticalAlignment="Top" Width="444" Grid.Row="1">
           <Grid.ColumnDefinitions>
               <ColumnDefinition Width="220*" />
               <ColumnDefinition Width="224*" />
           </Grid.ColumnDefinitions>
           <Grid.RowDefinitions>
               <RowDefinition Height="Auto" MaxHeight="200" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="196*" />
           </Grid.RowDefinitions>
           <Image Grid.Row="8" Height="109" HorizontalAlignment="Left" Margin="20,23,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="176" />
           <Image Grid.Column="1" Grid.Row="8" Height="109" HorizontalAlignment="Left" Margin="23,23,0,0" Name="image2" Stretch="Fill" VerticalAlignment="Top" Width="176" />
           <Image Grid.Row="9" Height="109" HorizontalAlignment="Left" Margin="20,22,0,0" Name="image3" Stretch="Fill" VerticalAlignment="Top" Width="176" />
           <Image Grid.Row="9" Height="109" HorizontalAlignment="Left" Margin="23,22,0,0" Name="image4" Stretch="Fill" VerticalAlignment="Top" Width="176" Grid.Column="1" />
           <Image Grid.Row="9" Height="109" HorizontalAlignment="Left" Margin="20,184,0,0" Name="image5" Stretch="Fill" VerticalAlignment="Top" Width="176" />
           <Image Grid.Row="9" Height="109" HorizontalAlignment="Left" Margin="23,184,0,0" Name="image6" Stretch="Fill" VerticalAlignment="Top" Width="176" Grid.Column="1" />
           <Image Grid.Row="9" Height="109" HorizontalAlignment="Left" Margin="20,330,0,0" Name="image7" Stretch="Fill" VerticalAlignment="Top" Width="176" />
           <Image Grid.Row="9" Height="109" HorizontalAlignment="Left" Margin="23,330,0,0" Name="image8" Stretch="Fill" VerticalAlignment="Top" Width="176" Grid.Column="1" />
       </Grid>



HTML

Posted

1 solution

Hi,

Maybe code below can help you.
C#
<scrollviewer>
          <grid margin="30">
            Width="300"
            Height="500"
                ScrollViewer.CanContentScroll="True"
                ScrollViewer.VerticalScrollBarVisibility="Auto"
                ScrollViewer.HorizontalScrollBarVisibility="Auto">
              <grid.rowdefinitions>
                  <rowdefinition />
                  <rowdefinition />
                  <rowdefinition />
                  <rowdefinition />
                  <rowdefinition />
                  <rowdefinition />
                  <rowdefinition />
                  <rowdefinition />
                  <rowdefinition />
              </grid.rowdefinitions>
              <grid.columndefinitions>
                  <columndefinition />
                  <columndefinition />
              </grid.columndefinitions>
              <image x:name="source" xmlns:x="#unknown">
                 Source="Koala.jpg"
                 Stretch="Fill"/>
              <image x:name="source1">
                 Source="Koala.jpg"
                 Stretch="Fill"
                 Grid.Row="1"/>
              <image x:name="source2">
                 Source="Koala.jpg"
                 Stretch="Fill"
                 Grid.Row="2"/>
              <image x:name="source3">
                 Source="Koala.jpg"
                 Stretch="Fill"
                 Grid.Row="3"/>
              <image x:name="source4">
                 Source="Koala.jpg"
                 Stretch="Fill"
                 Grid.Row="4"/>
              <image x:name="source5">
                 Source="Koala.jpg"
                 Stretch="Fill"
                 Grid.Row="5"/>
              <image x:name="source6">
                 Source="Koala.jpg"
                 Stretch="Fill"
                 Grid.Row="6"/>
              <image x:name="source7">
                 Source="Koala.jpg"
                 Stretch="Fill"
                 Grid.Row="7"/>
              <image x:name="source8">
                 Source="Koala.jpg"
                 Stretch="Fill"
                 Grid.Row="8"/>
          </image></image></image></image></image></image></image></image></image></grid>
          </scrollviewer>
 
Share this answer
 
Comments
Raghavanand 29-Nov-12 23:42pm    
I am getting a error in this line "ScrollViewer.CanContentScroll="True""

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900