1
Q
着色列表框
A
回答
4
是的,這是可能的。您可以使用ListBox的AlternationCount屬性。像
<Style TargetType="{x:Type ListBoxItem}">
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="White"></Setter>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="LightGray"></Setter>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="2">
<Setter Property="Background" Value="Gray"></Setter>
</Trigger>
</Style.Triggers>
</Style>
然後東西只設置你的ListBox
<ListBox AlternationCount="3"
...>
相關問題
- 1. 着色線框
- 2. Flash AS3 - 着色的用戶名列表框不同的顏色
- 3. 複選框着色
- 4. 帶有行着色功能的MS Access VBA列表框?
- 5. 在列表框中着色重複的項目
- 6. 着色串的不同部分,內的列表框(DELPHI)
- 7. 在列表中着色數字(乳膠)
- 8. 着色wpf複選框C#
- 9. Wpf複選框着色
- 10. GLSL邊框着色器
- 11. 着色項目表
- 12. 前景列表框顏色
- 13. 在excel中着色多列
- 14. WPF DataGrid列交替着色
- 15. 交替着色表格行
- 16. Java着色表格行
- 17. Css着色表問題
- 18. 如何爲圖表着色
- 19. 着色DC.JS Choropleth圖表
- 20. 表斑馬顏色不着色整行
- 21. 使用替代顏色着色表
- 22. 表面着色器中的統一着色器頂點格式
- 23. 將表面着色器轉換爲片段着色器
- 24. GLSL:頂點着色器無片段着色片段着色器
- 25. asp.net列圖中每列的着色c#
- 26. Spotfire中跨可視化表 - 着色基於列標題的列
- 27. 桌面邊框不會着色
- 28. 頂點着色器中的邊界框
- 29. Scrapy框架 - 着色日誌記錄
- 30. SWT:如何爲殼邊框着色?
謝謝,這確實起作用的AlternationCount。但是我有2個ListBox,它們都是相同的形式,都得到這個,並且兩個Listbox都得到這個着色 – user489753 2010-10-28 07:02:38
這個樣式是針對ListBoxItem的,所以它將適用於所有的列表框。 – 2010-10-28 07:09:33
好的,讓它工作。再次感謝 – user489753 2010-10-28 19:01:54