Windowsphone网格——如何隐藏行和列? - Windows phone Grid - how hide row and column?

- 此内容更新于:2016-01-23
主题:

我创建了应用程序与MVVM十字架。我用这个网格:当我点击图片应该填满整个电网。新媒体显示所有图片。我点击image1——image1填满整个电网。其他图像是隐藏的。我可以隐藏其他图像但选中的图像并不紧张。如何实现它呢?也许你需要使用不同类型的板吗?

原文:

I create application with MVVM Cross. I use this grid:

 <Grid>
   <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition/>
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>

    <Image Grid.Row ="0" Grid.Column ="0" />
    <Image Grid.Row ="0" Grid.Column ="1" />
    <Image Grid.Row ="1" Grid.Column ="0" />
    <Image Grid.Row ="1" Grid.Column ="1" />  
 </Grid>

enter image description here

When I click on the picture it should fill the entire grid. The new press displays all pictures. I click image1 - image1 fill the entire grid. Other images are hidden. I can hide other images but the selected image is not stretched. How to implement it? Perhaps you need to use a different type of panels?

网友:您可以使用网格。行宽和网格。ColumnSpan触发单击事件时和拉伸图像来填补,我猜。

(原文:You can use Grid.RowSpan and Grid.ColumnSpan when the click event is fired and stretch the image to fill, I guess.)

楼主:我使用Mvvm十字架。我认为这并非易事。

(原文:I use Mvvm Cross. I think it will not be easy.)

网友:对不起。我不知道MvvmCross。它工作否则写以下的单击事件,网格。SetColumnSpan(image12);网格。SetRowSpan(image12);

(原文:Sorry. I don't know about MvvmCross. It works otherwise writing the following in the click event, Grid.SetColumnSpan(image1, 2); Grid.SetRowSpan(image1, 2);)

解决方案:
我不确定你想要达到什么但安排图像像画你必须使用这段代码:
原文:

I am not sure what you would like to attain but to arrange images like on drawing you have to use this code:

 <Grid>
   <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>

<Grid Grid.Row = "0" >
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Image Grid.Column ="0" />
    <Image Grid.Column ="1" />
</Grid>

<Grid Grid.Row = "1" >
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Image Grid.Column ="0" />
    <Image Grid.Column ="1" />
</Grid>

 </Grid>