Windows phone 7 我怎么能做这样的东西?(应用程序内的瓷砖)Windows phone

Windows phone 7 我怎么能做这样的东西?(应用程序内的瓷砖)Windows phone,windows-phone-7,silverlight-4.0,tiles,toolkit,Windows Phone 7,Silverlight 4.0,Tiles,Toolkit,如果问题的标题不清楚,我很抱歉,但我正在尝试这样做。我不知道它们是WrapControl中的平铺还是图像: 我在考虑用一个包裹面板制作这样的东西,每一块都是堆叠面板。但我不确定这是否是正确的方法 是否有控件可以执行此操作?您的操作是正确的WrapPanel就是要走的路:) 为了使每个块更有趣,您可以查看最新的控件。无论您使用什么控件/面板,请记住大小应为173*173 使用列表框 <!-- set its ItemContainerStyle which is the

如果问题的标题不清楚,我很抱歉,但我正在尝试这样做。我不知道它们是WrapControl中的平铺还是图像:

我在考虑用一个包裹面板制作这样的东西,每一块都是堆叠面板。但我不确定这是否是正确的方法


是否有控件可以执行此操作?

您的操作是正确的
WrapPanel
就是要走的路:)

为了使每个块更有趣,您可以查看最新的控件。无论您使用什么控件/面板,请记住大小应为173*173

使用列表框

        <!-- set its ItemContainerStyle which is the style for each ListBoxItem -->
        <ListBox ItemContainerStyle="{StaticResource TileListBoxItemStyle}">
            <!-- set its ItemsPanel to be a WrapPanel -->
                <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <toolkit:WrapPanel />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBoxItem>
                <Grid>
                    <TextBlock Text="Messages" />
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Path Data="M1.4901163E-05,9.8579922 L50.000015,46.316994 L100.00002,9.8579922 L100.00002,62.499992 L1.4901163E-05,62.499992 z M0,0 L100,0 L50,36.458 z" Fill="White" Height="38.125" Stretch="Fill" UseLayoutRounding="False" Width="61" d:IsLocked="True" />
                        <TextBlock Text="12" Margin="4,0,0,8" />
                    </StackPanel>
                </Grid>
            </ListBoxItem>
            <ListBoxItem/>
            <ListBoxItem/>
            <ListBoxItem/>
            <toolkit:HubTile Title="Me ☺" Message="..." Notification="new messages!" Source="xxx.jpg" Margin="12,12,0,0" />
        </ListBox>
在我的一个项目中,我创建了一个执行所有这些操作的
列表框。我使用
ListBox
的原因是
ListBox
有一个
SelectedItem
属性,它告诉我用户点击了哪个磁贴。另一个原因是
ListBoxItems
可以收到良好的倾斜效果

实际上,您只需要创建一个类似于
ListBoxItem
样式的平铺,并将其应用于
ListBox
ItemContainerStyle
,还需要将
ListBox
ItemsPanel
设置为
WrapPanel

它看起来怎么样

ListBoxItem样式

<Style x:Key="TileListBoxItemStyle" TargetType="ListBoxItem">
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="VerticalContentAlignment" Value="Stretch"/>
    <Setter Property="Padding" Value="0"/>
    <Setter Property="FontSize" Value="64"/>
    <Setter Property="Margin" Value="12,12,0,0"/>
    <Setter Property="Background" Value="{StaticResource PhoneAccentBrush}"/>
    <Setter Property="Foreground" Value="White"/>
    <Setter Property="Width" Value="173"/>
    <Setter Property="Height" Value="173"/>
    <Setter Property="HorizontalAlignment" Value="Left"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ListBoxItem">
                <Grid>
                    <Rectangle Fill="{TemplateBinding Background}"/>
                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

列表框

        <!-- set its ItemContainerStyle which is the style for each ListBoxItem -->
        <ListBox ItemContainerStyle="{StaticResource TileListBoxItemStyle}">
            <!-- set its ItemsPanel to be a WrapPanel -->
                <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <toolkit:WrapPanel />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBoxItem>
                <Grid>
                    <TextBlock Text="Messages" />
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Path Data="M1.4901163E-05,9.8579922 L50.000015,46.316994 L100.00002,9.8579922 L100.00002,62.499992 L1.4901163E-05,62.499992 z M0,0 L100,0 L50,36.458 z" Fill="White" Height="38.125" Stretch="Fill" UseLayoutRounding="False" Width="61" d:IsLocked="True" />
                        <TextBlock Text="12" Margin="4,0,0,8" />
                    </StackPanel>
                </Grid>
            </ListBoxItem>
            <ListBoxItem/>
            <ListBoxItem/>
            <ListBoxItem/>
            <toolkit:HubTile Title="Me ☺" Message="..." Notification="new messages!" Source="xxx.jpg" Margin="12,12,0,0" />
        </ListBox>

您可以看到最后一项实际上是一个
hubbile


希望有帮助!:)

@Xin你能给我推荐一个链接或者一些例子吗。。。我正处于学习阶段。。。我想在我的应用程序中做上面的事情。@SanghatiMukherjee上面的回答还不够吗?:)