views:

15

answers:

0

I have written a fairly simple timeline control which extends control. It has a generic template that displays correctly when the control is used by itself.

I have put the control in an ItemsControl and now no templates are being applied to the timeline (OnApplytemplate() isn't firing). I cannot for the life of me figure out what the problem is, any help would be greatly appreciated.

<ItemsControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Name="TimelineItemsControl" ItemsSource="{Binding Path=UniqueRecursedChildren, Mode=OneWay}">
    <ItemsControl.Template>
        <ControlTemplate>
            <ItemsPresenter />
        </ControlTemplate>
    </ItemsControl.Template>

    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Vertical" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>

    <ItemsControl.ItemTemplate>
        <DataTemplate>

            <DataTemplate.Resources>

            </DataTemplate.Resources>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="60" />
                    <ColumnDefinition Width="1000" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="30" />
                    <RowDefinition  Height="70" />        
                </Grid.RowDefinitions>
                <Label Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Content="{Binding Path=Name}" />

                <Label Grid.Column="0" Grid.Row="2" Content="Status" />
                <Timeline:Timeline  Grid.Column="1" Grid.Row="2" Height="70" Width="500" DataContext="{Binding Path=StatusTimeline}" />


            </Grid>
        </DataTemplate>
    </ItemsControl.ItemTemplate>

    <ItemsControl.ItemContainerStyle>
        <Style>
            <Setter Property="Control.Margin" Value="10" />
        </Style>
    </ItemsControl.ItemContainerStyle>
</ItemsControl>