Windows Phone中的gridview [英] gridview in windows phone

查看:51
本文介绍了Windows Phone中的gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我是Windows Mobile开发的新手.

我正在执行一项任务,其中需要在一页中放入18张图像.我正在为此使用网格视图.我为该任务创建了9行定义.但是我无法将图像添加到每个块并获得滚动视图的输出.我为网格放置了一个滚动视图.

现在,我需要将输出作为滚动页面.我正在发布代码

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

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








推荐答案



也许下面的代码可以为您提供帮助.
Hi,

Maybe code below can help you.
<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>


这篇关于Windows Phone中的gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆