I can't set a border around my StackPanel. Any help?

Posted by Sergio Tapia on Stack Overflow See other posts from Stack Overflow or by Sergio Tapia
Published on 2010-04-18T16:47:36Z Indexed on 2010/04/18 16:53 UTC
Read the original article Hit count: 350

Filed under:
|
|
|

Here's my XAML code:

<Window x:Class="CarFinder.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Search for cars in TuMomo" Height="480" Width="600">
    <DockPanel Margin="8">
        <Border CornerRadius="6"
                BorderBrush="Gray"
                Background="LightGray"
                BorderThickness="2"
                Padding="8">
            <StackPanel Orientation="Horizontal"
                    DockPanel.Dock="Top"
                    Height="25">
                <TextBlock FontSize="14" Padding="0 0 8 0">
                    Search:
                </TextBlock>
                <TextBox x:Name="txtSearchTerm" Width="400" />
                <Image Source="/CarFinder;component/Images/Chrysanthemum.jpg" />            
            </StackPanel>
        </Border>
        <StackPanel Orientation="Horizontal"
                    DockPanel.Dock="Top"
                    Height="25">

        </StackPanel>
    </DockPanel>
</Window>

The border is set around the entire window. And also, when I create another StackPanel it's added to the right of my previous StackPanel instead of being added under it. What's the reason for this?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about beginner