Click here to Skip to main content
Rate this: bad
good
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>
 
<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:
 
http://www10.pic-upload.de/24.08.12/95vtc2wui54g.png
 
This is my Window code:
 
<Window x:Class="NeonMika.EightTracksPlayer.SwitchSelector"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:track="clr-namespace:NeonMika.EightTracks;assembly=NeonMika.EightTracks"
        xmlns:local="clr-namespace:NeonMika.EightTracksPlayer"
        Title="SwitchSelector" Height="670" Width="959" MinWidth="500"
        removed="{StaticResource MainBackground}">
        <DockPanel Margin="0" VerticalAlignment="Stretch">
            <local:HeaderControl DockPanel.Dock="Top">
            </local:HeaderControl>
 
            <local:ControlArea DockPanel.Dock="Bottom">
            </local:ControlArea>
 
            <ContentControl Name="ContentArea"></ContentControl>
        </DockPanel>
</Window>
 
I tried every VerticalAlignment="Strech" you can imagine :P
Can you help me?

 
---------------------------------------
 
UPDATE:
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 18:58pm
Edited 23-Aug-12 19:49pm
v2

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

  Print Answers RSS
0 OriginalGriff 469
1 ChintanShukla 305
2 Sergey Alexandrovich Kryukov 253
3 RyanDev 250
4 Richard Deeming 250
0 Sergey Alexandrovich Kryukov 8,906
1 OriginalGriff 7,601
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,923


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 24 Aug 2012
Copyright © CodeProject, 1999-2014
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