WPF 列表视图样式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14438425/
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 07:08:15  来源:igfitidea点击:

WPF ListView Styling

c#wpfxaml

提问by Chrisjan Lodewyks

I've only started using the WPF ListView now and I have a few questions:

我现在才开始使用 WPF ListView,我有几个问题:

  • Is there a way for me to apply a style where every second row is a bit darker, just for readability?
  • What is the ListView equivelant for Width="*"?
  • Where can I find a decent looking style?
  • 有没有办法让我应用一种样式,每行都稍微暗一点,只是为了可读性?
  • Width="*" 的 ListView 等效项是什么?
  • 我在哪里可以找到体面的风格?

Thanx

谢谢

回答by Rohit

A few seconds of googling will give you results likeWPF ListView

几秒钟的谷歌搜索会给你像WPF ListView这样的结果

and WPF Listview customize

WPF Listview 自定义

and with your second question

和你的第二个问题

"*" means stretch to fill the available space, and is a fraction, so if one row is * and the other row is 2* then the second row will be twice the size of the first row.

“*”表示拉伸以填充可用空间,并且是一个分数,因此如果一行是 * 而另一行是 2* 则第二行的大小将是第一行的两倍。

Hope it helps

希望能帮助到你

回答by Net Dev

1- Check out the AlternationCount property on the ListView. It allows alternate rows to be styled differently.

1- 检查 ListView 上的 AlternationCount 属性。它允许交替行的样式不同。

http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.alternationcount.aspx

http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.alternationcount.aspx

It seems someone has answered a similiar question here: wpf datagrid alternate row coloring

似乎有人在这里回答了一个类似的问题: wpf datagrid交替行着色

2- If your looking to size the ListBox to the container try looking at some of the layout containers like at CodeProject. Specifically the DockPanel.

2- 如果您希望将 ListBox 的大小调整为容器,请尝试查看一些布局容器,例如CodeProject。特别是 DockPanel。

3- Where can I find free WPF controls and control templates?

3-我在哪里可以找到免费的 WPF 控件和控件模板?