Nested WinFX Custom Controls

I have a custom colorpicker control a'la Kevin Moore's example in the SDK and I'm using it within another custom control. The parent control has a color dependency property that I'm trying to bind to the colorpicker like so in the parent control's generic.xaml resource dictionary:

<cust:ColorPicker x:Name="myColorPicker" Color="{Binding Path=ParentControlColor, RelativeSource={RelativeSource TemplatedParent}}"/>

But this doesn't seem to work. Actually...this doesn't even work:

<cust:ColorPicker

x:Name="myColorPicker" Color="Red"/>

Color is exposed as a dependency property in the colorpicker control.

When I change values in the colorpicker it doesn't cause the parent control's "changed" event to fire either...even though the other dependency properties in the parent control DO cause the "changed" event to fire.

Do I need an additional converter in the parent control or something?

[1211 byte] By [Leebert] at [2007-12-22]
# 1

Can you include the XAML that shows the Parent control? Is the ColorPicker part of the template of the parent control?

Is the property on the parent control literally named "ParentControlColor"? Can you include your dependency property registration for that property?

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

Visual Studio Orcas

Site Classified