Click here to Skip to main content
12,694,842 members (33,180 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# XAML WPF Style
Hey out there, my next WPF question :P

I have a "basic style" in my app.xaml, and the following style makes trouble:

<Style x:Key="BasicStyle">
  <Setter Property="FrameworkElement.VerticalAlignment" Value="Center"></Setter>
  <Setter Property="FrameworkElement.Margin" Value="3,1,3,1"></Setter>

<Style TargetType="Image" BasedOn="{StaticResource BasicStyle}"></Style>

<Style TargetType="StackPanel" BasedOn="{StaticResource BasicStyle}"></Style>

<Style TargetType="DockPanel" BasedOn="{StaticResource BasicStyle}"></Style>

etc., etc...

Now when I start my program (which has a DockPanel on the top, one on the bottom and one ScrollViewer in the middle) it is flat and has a black border on the top and bottom. I don't know if this is allowed (please remove it if not), but here is a picture of what i mean:

This is my Window code:

<Window x:Class="NeonMika.EightTracksPlayer.SwitchSelector"
        Title="SwitchSelector" Height="670" Width="959" MinWidth="500"
        removed="{StaticResource MainBackground}">
        <DockPanel Margin="0" VerticalAlignment="Stretch">
            <local:HeaderControl DockPanel.Dock="Top">

            <local:ControlArea DockPanel.Dock="Bottom">

            <ContentControl Name="ContentArea"></ContentControl>

I tried every VerticalAlignment="Strech" you can imagine :P
Can you help me?


I found out the the style for Border is the problem. It seems my whole application has a border around it. When I set VerticalAlignment="Stretch" on the Border style, it has the normal style, but now I see for the first time that there is a small black line (Border) surrounding my window. Is it possible that my window has a "built in" border I don't know about?

Thanks in advance, Markus
Posted 23-Aug-12 19:58pm
Updated 23-Aug-12 20:49pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 24 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100