Binding to the visual tree of a DataTemplate

[edit: title changed, to be more descriptive]

I have the following DataTemplate, and I'm wanting to bind the contents of my overriden panel to a list of classes that will use the same DataTemplate or one other.

<DataTemplate DataType="{x:Type tll:TimelineGroup}">
<Border BorderBrush="Gray" BorderThickness="1">
<StackPanel Orientation="Vertical" Margin="5 5 5 5">
<StackPanel Orientation="Horizontal">
<Rectangle Width="75" Height="20" Stroke="Black" Fill="Aqua"
Margin="10 0 10 0" />
<TextBlock Text="{Binding DateAsString}" VerticalAlignment="Center"
FontStyle="Italic" FontSize="12" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" Margin="10
0 10 0" FontSize="12" />
</StackPanel>
<TextBlock Text="{Binding Description}" Margin="10 0 10 0" />

<!-- Binding done here --!>
<tlc:SlotItemPanel VisualChildren="{Binding ChildNodes}" />
</StackPanel>
</Border>
</DataTemplate>

The DataTemplate is bound to a group object that has a list of both TimelineGoups and TimelineEvents. In effect, it would be a recursive DataTemplate when it was a TimelineGroup. TimelineEvents has its own DataTemplate but no children.

The above binding doesn't work, so I'm hoping for another way to do this. VisualChildren is a dependancy property defined as:

public static readonly DependencyProperty SetVisualChildrenProperty =
DependencyProperty.Register("VisualChildren", typeof(IList<TimelineItemBase>),
typeof(SlotItemPanel));
public IList<TimelineItemBase> VisualChildren
{
get { return (IList<TimelineItemBase>) GetValue(SetVisualChildrenProperty); }
set { SetValue(SetVisualChildrenProperty, value); }
}

[1840 byte] By [wadnerk] at [2007-12-22]
# 1

Do you define the ChildNodes property?

On which object is ChildNodes defined?

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

Visual Studio Orcas

Site Classified