3

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

  • 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?

Thanx

Chrisjan Lodewyks
  • 1,162
  • 4
  • 13
  • 25
  • 1
    1) http://dotnetbutchering.blogspot.co.uk/2009/08/how-to-set-wpf-listview-alternate-row.html – paul Jan 21 '13 at 12:20
  • 2) http://stackoverflow.com/questions/1257500/c-sharp-listview-column-width-auto – paul Jan 21 '13 at 12:20

3 Answers3

2

All of your questions have been answered previously here:

Community
  • 1
  • 1
bitbonk
  • 48,890
  • 37
  • 186
  • 278
  • Any idea how I can add vertical grid lines after each column using a style? – Chrisjan Lodewyks Jan 22 '13 at 09:59
  • You could use the GridLinesVisibility property: http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.gridlinesvisibility%28v=vs.95%29.aspx – bitbonk Jan 22 '13 at 10:14
  • There is no such property on ListView or GridViewColumn. – Chrisjan Lodewyks Jan 22 '13 at 10:19
  • Oops, my fault, you could either start using the DataGrid instead of the ListView or do it like this: http://blogs.microsoft.co.il/blogs/tomershamam/archive/2007/12/16/wpf-listview-vertical-lines-horizontal-as-bonus.aspx – bitbonk Jan 22 '13 at 12:45
0

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

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

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.

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

Community
  • 1
  • 1
Net Dev
  • 416
  • 4
  • 21
0

A few seconds of googling will give you results likeWPF ListView

and WPF Listview customize

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.

Hope it helps

Rohit
  • 10,056
  • 7
  • 50
  • 82