Silverlight 4 Binding to ConverterParameter

Posted by FrEEzE2046 on Stack Overflow See other posts from Stack Overflow or by FrEEzE2046
Published on 2010-12-22T12:52:30Z Indexed on 2010/12/22 12:54 UTC
Read the original article Hit count: 142

Filed under:
|
|
|

Hello everybody,

I have a ValueConverter which needs to be called with a dynamic parameter, depending on a property. I can't see a way to do this ...

Width="{Binding ActualWidthValue, Source={StaticResource VisibleSize}, Converter={StaticResource Fraction}}"

The "Fraction" converter get's (or should get) a parameter of type System.Size, which contains a numerator and denumerator. This value (should) depend on a ItemCollection.Count. Resetting the ItemCollection should reinvoke the Converter with the new values.

My first idea was to manually change the ConverterParameter in CodeBehind on the PropertyChanged event of my ItemCollection DependencyProperty. But, as I know now, Silverlight has no GetBinding() method. I heard about GetBindingExpression and tried to do. But MyGrid.GetBindingExpression(Grid.ActualHeightProperty) is always returning null, although the Binding is already established.

So, what can I do to reach my target?

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about dynamic