tags:

views:

115

answers:

1

I have a ListView that is configured as a GridView. It is databound to a DataTable and displays several columns of ints. I'd like to display the maximum value in each column in the bold font.

To do this, I have a MultiBinding on the FontWeight of each cell. It is easy enough to pass the cell value to the MultiBinding converter. But how do I pass all of the items in that column to the converter? Or is there a way to pass the the entire databound DataTable to the converter?

A: 

One way you could do it is expose your DataTable in the view itself as a property. Then with your converter bind to the DataTable and set ConverterParameter to the name of the column.

... FontWeight="{Binding Converter={StaticResource MaxValueConverter}, ElementName=MyControl, Path=MyDataTable, ConverterParameter='ColumnName'}"/>

Unfortunately, you can't do this..

... FontWeight="{Binding Converter={StaticResource MaxValueConverter}, Path={Binding}}"/>

..but it would make binding to the DataContext much easier.

Jeff Wain