Multi-binding inside Multi-binding

You can’t.

Well, that was the short version of things. Now comes the long one.

Take the following piece of XAML:

<Label x:Name="color">
    <MultiBinding Converter="{StaticResource luminanceConverter}">
        <Binding Path="AddedLuminance" />
        <MultiBinding Converter="{StaticResource rgbToCmyk}">
            <Binding Path="R" />
            <Binding Path="G" />
            <Binding Path="B" />
        </MultiBinding>
    </MultiBinding>
</Label>

The above fictional piece of code takes a color’s RGB (Red/Green/Blue) values, converts it to a CMYK (Cyan/Magenta/Yellow/Black) representation and then adds luminance. This is all done to display a value for the user which the application doesn’t need to compute on its own for the sake of logic. It’s also useful, because whenever AddedLuminance, R, G or B change, the value is recalculated.

The only problem with the above code is that it doesn’t work, since apparently, you can’t place a MultiBinding inside a MultiBinding.

I guess I’ll have to wait for the next version for that one…

Advertisements

3 thoughts on “Multi-binding inside Multi-binding

  1. The specific reason you can’t do this is because a MultiBinding is not a DependencyObject subclass and bindings can only be applied to DOs.
    HTH,
    Drew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s