views:

65

answers:

0

I have a stackpanel as a place holder, and i would like to add multiple controls to it depending on user input. The problem i have having is that i get a "The property 'Template' was not found in type 'System.Windows.Controls.StackPanel'. [Line: 104 Position: 34]"

Here is my xmal

Style Element

           <Style TargetType="StackPanel" x:Name="VehicleStart">
            <Setter Property="Height" Value="73" />
            <Setter Property="Width" Value="43" />
            <Setter Property="Grid.Column" Value="0" />
            <Setter Property="Margin" Value="4" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="StackPanel">
                        <Grid Margin="2">
                            <Rectangle Fill="White" Height="71" Stroke="Black" VerticalAlignment="Top" Width="33"/>
                            <Ellipse Fill="Transparent" Height="22" Stroke="Black" VerticalAlignment="Bottom" Width="25"/>
                            <TextBlock Text="{Binding Path=Text}" />
                            <Rectangle Fill="Transparent" Height="71" Stroke="Black" VerticalAlignment="Top" Width="33"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter> 
        </Style>

Here is the usage

I am doing it in xaml so i can get it to work before moving to code. Style is in the Grid.Resource section and the code below is in side the grid.

      <StackPanel Style="{StaticResource VehicleStart}">

I have spent about 1/2 a day on this and stuck. I am new to silverlight and any help would be great