By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,678 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,678 IT Pros & Developers. It's quick & easy.

XAML MultiBinding and MultiConverter in a style definition

P: n/a

I would like to use a multibinding to determine the fill value of my
rectangle style.

<Style x:Key="StyleRect" TargetType="{x:Type Rectangle}">
<Setter Property="Fill">
<MultiBinding Converter="{StaticResource MyMultiValueConverter}">
<Binding Path="PropertyX"/>
<Binding Path="PropertyY"/>

MyMultiValueConverter is a MultiValueConverter using 2 properties PropertyX
and PropertyY. It returns a string representing a color (e.g. "#F155F1").
When I am in Debug mode, I can see that MyMultiValueConverter gives the
right color back, but it doesn't change the color of my rectangle.
My rectangle is part of a ListBox Data Template.

<Rectangle Style="{StaticResource StyleRect}" />
If I use a normal binding, that works:
<Style x:Key="StyleRect" TargetType="{x:Type Rectangle}">
<Setter Property="Fill">
<Binding Path="PropertyX" Converter="{StaticResource MyValueConverter}"/>

Thanks for your help
Jun 22 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.