0

My WPF generated window, once maximized, can't be moved to another window unless it's un maximized first.

I've basically removed (and added back) every element in the window properties to see if it will affect it.

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:DriverChat"
    mc:Ignorable="d" 
    Title="Geotab Messages" 
    Height="600" 
    Width="1080" 
    Loaded="Window_Loaded" 
    Icon="Chat.ico" 
    WindowStyle="SingleBorderWindow" 
    WindowState="Normal" 
    WindowStartupLocation="CenterScreen" 
    Background="#FF363E47"
    >
<WindowChrome.WindowChrome>
    <WindowChrome 
        CaptionHeight="0" 
        ResizeBorderThickness="5" 
        UseAeroCaptionButtons="False"/>
</WindowChrome.WindowChrome>
<Grid x:Name="windowGrid">
    <Grid.RowDefinitions>
        <RowDefinition Height="31"/>
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <ContentControl x:Name="TitleBar">
        <Border 
            Grid.Row="0" 
            Background="#FF363E47" 
            HorizontalAlignment="Stretch" 
            Height="31" 
            VerticalAlignment="Top">
            <Label 
                Content="Geotab Messages (BETA)" 
                FontSize="12" 
                FontWeight="Normal" 
                HorizontalContentAlignment="Center" 
                Margin="47,0" 
                Padding="5,3" 
                Foreground="#FFF7F7F7" 
                HorizontalAlignment="Left" 
                VerticalContentAlignment="Center"
                />
        </Border>
    </ContentControl>
<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Horizontal"  HorizontalAlignment="Right">
        <Button Style="{StaticResource Square}" x:Name="btnMin" Content="—" HorizontalAlignment="Right" Width="48" Background="#FF363E47" Foreground="#FFF7F7F7" BorderThickness="0" BorderBrush="Transparent"/>
        <Button Style="{StaticResource Square}" x:Name="btnMax" Content="⃞" FontSize="14" HorizontalAlignment="Right" Width="48" Background="#FF363E47" Foreground="#FFF7F7F7" BorderThickness="0" BorderBrush="Transparent" />
        <Button Style="{StaticResource Square}" x:Name="btnClose" Content="✕" FontSize="14" HorizontalAlignment="Right" Width="48" Background="#FF363E47" Foreground="#FFF7F7F7" BorderThickness="0" BorderBrush="Transparent"/>
    </StackPanel>

SOLUTION:

In the WindowChrome section, captionHeight needed to be changed to a non zero value to make it accessible by the user.

  • There's no way for the user to maximize, unmaximize, or move that window. All they can do is drag the edges to resize it. – 15ee8f99-57ff-4f92-890c-b56153 May 20 '19 at 14:11
  • I added more code which includes that part. It can be moved around and double clicked to maximize. But once it's maximized, it can't be moved to another window unless it's unmaximized – Cayla Lawrence May 20 '19 at 14:17
  • The XAML you added doesn't allow me to do those things. If you're trying to recreate all the behavior of a conventional windows titlebar, [this is what you're looking for](https://stackoverflow.com/a/6371340/424129). – 15ee8f99-57ff-4f92-890c-b56153 May 20 '19 at 14:20

0 Answers0