I have a ListBox where I set the ItemsSource to a CollectionViewSource that is populated from a WCF service. I use a value converter in the ListBox.ItemTemplate\DataTemplate to convert a property on the objects in the ItemsSource.
This all works as expected, but now I need to update the conversion process such that the converted value is still based on the individual object property values, except when a different property equals a specific value. And that value is set in the code behind of the xaml, this is field level variable set in the page constructor.
To do this I want pass the field level variable as the ValueConverter's ConverterParameter. I've tried several ways mainly using the ideas from this this question except I always get an error parsing the xaml (and the app fails to load).
One fix might be add a property to the objects in the ItemsSource but I don't really want to do that. Partially because that object is used in several projects so I don't want to change i .... and because I want to see if the other method is even possible. Also I believe wpf has a MultiValue Converter (and maybe SL 4.0) but I'm on SL 3.0.
My guess is the issues I've had so far are because of the timing of the loading, binding and the parsing of the xaml.
So a few questions:
- can this be done as I describe above?
- if not what is the issue?
- if not is there another way without add a property to the object?