I have a borderless window created for my WPF application. It resizes perfectly on the sides and corners and also when I drag it to the left or right side of the screen it perfectly scales to fit half the screen. If I use a button or other control event to maximize the window it works perfectly. However, when I drag the window to the top of the screen, the actual window maximizes but the grid inside it does not.
I have it set up to call a method on the sizeChanged event that sets the size of the grid relative to the window (it fills the entire window except 10 pixels on each edge). At first, I thought the sizeChanged event wasn't firing so I created a thread to just detect if the windowState was maximized. On detection it would simply run the method to size up the grid. The method ran, but the grid size didn't change. Only this method of maximization is a problem.
How do I fix this problem?
Edit: XAML
<Window.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF868686" Offset="0" />
<GradientStop Color="Black" Offset="1" />
</LinearGradientBrush>
</Window.Background>
<Grid Background="{x:Null}" Name="baseGrid">
<Grid Height="342" HorizontalAlignment="Stretch" Name="grid1" VerticalAlignment="Stretch" Width="718" Background="#46BA0000">
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="6,6,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="maximize" />
</Grid>
</Grid>
I'm also using a style and a theme in my application but this problem happens even when they aren't involved so i didnt include them in the XAML