473,395 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XAML MultiBinding and MultiConverter in a style definition

Hi,

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">
<Setter.Value>
<MultiBinding Converter="{StaticResource MyMultiValueConverter}">
<Binding Path="PropertyX"/>
<Binding Path="PropertyY"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Style>

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.

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

Thanks for your help
Jun 22 '07 #1
0 3888

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Ioannis Vranos | last post by:
Will XAML be mandatory in VS "Orcas"? -- Ioannis Vranos
4
by: Thilaka | last post by:
Hi guys, Recently i read some articles on Longhorn & XAML. & From what i learnt the future for developing UIs lies in XAML. Does this mean that I've got to learn XAML as developing UIs for web...
3
by: Brent | last post by:
OK i downloaded the new/addon framework 3 and downloaded the VS 2005 addon. I started with XAML. So far im like mehhhhhhhh. Anyone else have the same opinion? When i first heard about xaml i got...
2
by: azerty | last post by:
Hello I try to use xaml serializer framework to save in .xaml file my own hierarchical graph of object. The first step is done : I create my own file with something like this : <Root
6
by: moondaddy | last post by:
will CodeDom create XAML windows or just regular windows forms? If so, how to I tell it to create a xaml window instead of a windows form? thanks -- moondaddy@noemail.noemail
0
by: =?Utf-8?B?WmlnZ3lTaG9ydA==?= | last post by:
I have a sample XAML file: <StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Button Name="button2" Height="23" Width="300" Margin="31,37,0,0" Click="doit">Hello...
6
by: star-italia | last post by:
Hi, Is it possible to include a XAML file into another XAML file? For example If i have - Window1.xaml - Window2.xaml and both have a treeview with a custom Style, can i describe the style...
1
by: DeanB | last post by:
Please excuse my ignorance here as I have not used WPF for long, but what is the statement that tells what the "local:" identifier is that allows a window event to call a function in a .cs file? ...
4
by: moondaddy | last post by:
I have a user control located in the following path: projectFolder/PropertyControls/myControl.xaml and in myControl.xaml I have a reference to a resource dictionary like this: ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.