Как переопределить шаблон у элемента `StackPanel`, чтобы появился `BorderBrush` и `BorderThickness`?

Как переопределить шаблон у элемента StackPanel, чтобы появился BorderBrush и BorderThickness? Нужно сделать рамку у StackPanel, но без добавления и обертывания в элемент Border. Добавление делать нельзя, так StackPanel является шаблоном в DataTemplate. Прилагаю код:


                        <ItemsControl ItemsSource="{Binding Path=Glyphs}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate DataType="{x:Type local7:Glyph_MTemp}">
                                    <ItemsControl ItemsSource="{Binding Path=Segments}">
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate DataType="{x:Type local8:Segment_MTemp}">
                                                <Polyline Stroke="{Binding Stroke}"
                                                          StrokeThickness="{Binding StrokeThickness}"
                                                          Points="{Binding Points}"
                                                          StrokeLineJoin="Round"
                                                          StrokeStartLineCap="Round"
                                                          StrokeEndLineCap="Round"
                                                          Cursor="Hand">
                                                </Polyline>
                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <Canvas Height="{Binding Path=Height}"
                                                        Width="{Binding Path=Width}"
                                                        Background="Transparent" />
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                    </ItemsControl>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Height="{Binding Path=Height}"
                                            Width="{Binding Path=Width}"
                                            Background="Gray" Orientation="Horizontal"/>
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                        </ItemsControl>

Ответы (0 шт):