Binding to a non string - possible?

Hey all,

If I have something like this in my data template :-

<Rectangle Fill="{Binding Path=Color}" . . .

And Color comes from :-

private Color color;
public Color Color
{
get { return color; }
set { color = value; }
}

It won't work. But if I change the type from Color to String, it works. That's sorta ugly. Is this a Binding restriction that the type can only be String?

Thanks in advance.

[473 byte] By [NishantSivakumar] at [2007-12-24]
# 1

Blast! That failed because Fill needs a Brush and I used a Color :-(

As a note to other beginners, if you really need to use a Color property, then you'd need to write a converter class (derived from IValueConverter) that'd convert the Color to a Brush.

NishantSivakumar at 2007-10-8 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified