views:

91

answers:

2

Hi everyone,

I am having an issue with the xaml parser not liking my binding statement but i cannot see anything wrong with the statement.

Invalid attribute value {Binding VehicleSpeed, ConverterParameter={Binding InMiles}, Converter={StaticResource SpeedConverter}, Mode=TwoWay} for property DataMemberBinding

VehicleSpeed and InMiles are parameters on the class that I have in the DataContext property of the xaml top level grid of the xaml document.

This statement used to work without the ConverterParameter by it is now complaining after added the second binding to the "bool InMiles" that i am trying to pass through to the ValueConverter.

If anyone can see anything wrong with this line please let me know.

+2  A: 

Hi,

You cannot bind the converter parameter, because it is not a dependency property of the binding object.

Instead you can pass the whole data item to the converter and use its VehicleSpeed and InMiles properties in the Convert() method.

ligaz
I'm not sure how this would work for a TwoWay binding?
AnthonyWJones
Yep. It will be tricky with TwoWay data binding. May be a custom CellTemplate should be used for this column.
ligaz
How would you pass the whole data item to the converter? Is this in the primary binding?
Mark Cooper
Leave the binding path empty or '.'
ligaz
+1  A: 

I'm not sure you can use DataBinding for a Converter Parameter. I think instead you would need to pass in the bound object and access the properties from there.

Joel Cochran