windows-phone-7 – 如何做这样的事情? (应用程序内的瓷砖)Windows手机
对不起,如果问题标题不清楚,但我正在尝试这样做,我不知道如果他们是一个WrapControl中的瓷砖或图像: 我正在考虑用封装面板做这样的事情,每一个块都是堆叠面板。但我不知道这是否是正确的方法。 有没有办法做这样的事情? 你在正确的轨道上。 WrapPanel是要走的路:)为了使每个块更有趣,您可以从最新的windows phone toolkit中查看HubTile控件。无论使用哪个控件/面板,只需记住大小应为173 * 173。 使用ListBox 在我的一个项目中,我创建了一个ListBox来完成所有这些。我使用ListBox的原因是因为ListBox有一个SelectedItem属性,它告诉我哪个tile被用户点击。另外一个原因是ListBoxItems可以收到很好的倾斜效果。 Baiscally你只需要创建一个像瓷砖的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"/> <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,8" /> </StackPanel> </Grid> </ListBoxItem> <ListBoxItem/> <ListBoxItem/> <ListBoxItem/> <toolkit:HubTile Title="Me " Message="..." Notification="new messages!" Source="xxx.jpg" Margin="12,0" /> </ListBox> 你可以看到最后一个项目其实是一个HubTile。 希望有帮助! (编辑:鄂州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- WIN10家庭中文版远程提示要求的函数不支持 win10
- POJ2823 Sliding Window(单调队列,线段树,set,
- Windows下使用service.bat安装tomcat服务, 启动停
- windows-8 – 如何在WinRT中将UI虚拟化应用于Scr
- windows 用浏览器打开应用程序的方法
- .net – 加载Azure Storage 2.0时出错 – 无法加
- windows – ruby win32apistructs(VerQueryValue
- 将PDF文件/对象插入Microsoft Excel时出现“无法
- 如何在Windows 7上安装PHP 7的MongoDB驱动程序?
- Windows环境 安装dlib(python) 总结