wpf Windows 8 Metro 风格的列表框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11815235/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 04:50:37  来源:igfitidea点击:

Windows 8 Metro style listbox

c#wpfxamlwindows-8

提问by sma6871

I'm building a wpf metro style application, but for the start, page I needed to create Windows 8 start screen like listbox in windows 7and .NetFramework 4.0.

我正在构建一个 wpf Metro 风格的应用程序,但首先,我需要在Windows 7.NetFramework 4.0 中创建像列表框这样的 Windows 8 开始屏幕的页面

I used Listbox and Wrappanel now, but as you see it's not clear!!!

我现在用的是 Listbox 和 Wrappanel,但如你所见,它不清楚!!!

enter image description here

在此处输入图片说明

Please help me to fill the blank cell.

请帮我填写空白单元格。

EDITchange place of buttons enter image description here

编辑改变按钮的位置 在此处输入图片说明

回答by varholl

this is not trivial at all... even microsoft guys told me that on a recent training I had..

这一点都不是微不足道的......甚至微软的人告诉我,在最近的一次培训中我......

I recommend following the following article which has something very close to what you need!

我建议您阅读以下文章,该文章非常接近您的需要!

http://tozon.info/blog/post/2012/09/01/Variable-sized-grid-items-in-Windows-8-apps.aspx

http://tozon.info/blog/post/2012/09/01/Variable-sized-grid-items-in-Windows-8-apps.aspx

Hope it helps!

希望能帮助到你!

回答by Nicolas Voron

VariableSizeWrapGriddoes the trick :

VariableSizeWrapGrid可以解决问题:

<GridView>
  <GridView.ItemsPanel>
    <ItemsPanelTemplate>
      <VariableSizeWrapGrid ItemHeight="100" ItemWidth="150"/>
    </ItemsPanelTemplate>
  </GridView.ItemsPanel>   
</GridView>

Example of result :

结果示例:

enter image description here

在此处输入图片说明

回答by Arnaud Weil

Use a WrapPanel for layout and you're done:

使用 WrapPanel 进行布局,您就完成了:

<ListBox>
  ...
  <ListBox.ItemsPanel>
    <ItemsPanelTemplate>
      <WrapPanel />
    </ItemsPanelTemplate>
  </ListBox.ItemsPanel>
</ListBox>