Windows phone 7 如何在网格中的图像中放置图像?

Windows phone 7 如何在网格中的图像中放置图像?,windows-phone-7,windows-phone-7.1,Windows Phone 7,Windows Phone 7.1,我需要将图像并排放置,并需要在每个图像下方放置一个小图像图标。请帮助我如何设计?任何样本请让我知道 如何根据条件将userimage动态放置在一个小图像中..请帮助我..使用此 <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid Grid.

我需要将图像并排放置,并需要在每个图像下方放置一个小图像图标。请帮助我如何设计?任何样本请让我知道

如何根据条件将userimage动态放置在一个小图像中..请帮助我..

使用此

<Grid>
  <Grid.ColumnDefinitions>
    <ColumnDefinition/>
    <ColumnDefinition/>   
  </Grid.ColumnDefinitions>
    <Grid Grid.Column="0">
      <Grid.RowDefinitions>
      <RowDefinition/>
      <RowDefinition/>
     </Grid.RowDefinitions>
       <Image Source="Your image" Grid.Row="0"/>
       <Image Source="Your small icon" Grid.Row="1"/>
  </Grid>

<Grid Grid.Column="1">
  <Grid.RowDefinitions>
    <RowDefinition/>
    <RowDefinition/>
  </Grid.RowDefinitions>
   <Image Source="Your image" Grid.Row="0"/>
   <Image Source="Your small icon" Grid.Row="1"/>
</Grid>

</Grid>


但是在这里,你必须对图标面板做一些修改,比如设置一些边距,以便使其与实际图像对齐


这只是另一种选择,你也可以使用核子回答的网格,如果你想在列表框中显示你的图像,那么在包装面板中以这种方式包装,你也可以设置包装的方向。Wrappanel可在WindowsPhone7的silverlight工具包中找到

                         <ListBox Name="lstImages">
                                <ListBox.ItemContainerStyle>
                                    <Style TargetType="ListBoxItem">
                                        <Setter Property="Padding" Value="-15" />
                                        <Setter Property="Margin" Value="0"/>
                                    </Style>
                                </ListBox.ItemContainerStyle>
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <toolkit:WrapPanel>
                                        </toolkit:WrapPanel>
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                  <stackpanel>
                                  <Image Source="Your image" />
                                  <Image Source="Small image" />
                                  </stackpanel>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>


并将此列表框与您收集的数据绑定。

我为您制作了简单的原型。我不能为你制作整个屏幕。以下是我从你的评论和截图中得到的基本信息。请参见下面的XAML和屏幕截图:

 <ListBox Name="lstImages" VerticalAlignment="Top">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Padding" Value="0,0,0,-15" />
                        <Setter Property="Margin" Value="2"/>
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <toolkit:WrapPanel>
                        </toolkit:WrapPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <Image Height="100" Width="110" Source="{Binding BigImageSource}" VerticalAlignment="Top"/>
                            <Image Height="10" Width="10" Source="{Binding SmallImageSource}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,-35,10,0"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>


任何样品请告诉我。嗨,请告诉我如何像上面的屏幕截图那样设计屏幕。如何将图像放在小图像和文本块中…如何为其提供项目容器样式。我正在使用上面的代码绑定项目,以及如何像上面的屏幕截图那样设计屏幕。可能的重复请不要继续添加与前面相同的问题一个。如果你想添加更多信息,请更新原来的问题,而不是创建一个全新的问题-这对任何人都没有帮助,如果你能在这个截图中看到我在每张图片上添加了搜索图标。你可以在蓝色的一个屏幕上看到这个图标。我缺少小图标,所以我使用了这个图标,但它没有png那么清晰。:)谢谢@Arslan。您能告诉我如何设置小图像的边距吗?我将所有控件放在堆栈面板中,并将其作为小图像放在底部。我从右边和底部给边距,以获得所需的形状。请查看silverlight控件。希望这对你有帮助
 <ListBox Name="lstImages" VerticalAlignment="Top">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Padding" Value="0,0,0,-15" />
                        <Setter Property="Margin" Value="2"/>
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <toolkit:WrapPanel>
                        </toolkit:WrapPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <Image Height="100" Width="110" Source="{Binding BigImageSource}" VerticalAlignment="Top"/>
                            <Image Height="10" Width="10" Source="{Binding SmallImageSource}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,-35,10,0"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>