Hi,
You can achieve this using
MouseLeave and
MouseEnter events of the WPF Window, But this solution will create a fluctuation when you move cursor near to title bar. So I suggest you to use
Mahapps.Metro - a UI toolkit for WPF. It provides extended properties for WPF window. Follow the steps provided in the above link.
And Add two events
MouseLeave,
MouseEnter to the WPF window. Use the below code in respective events.
MouseEnter event:
private void Window_MouseEnter(object sender, MouseEventArgs e)
{
this.ShowTitleBar = true;
this.ShowCloseButton = true;
this.ShowMinButton = true;
this.ShowMaxRestoreButton = true;
}
MouseLeave event:
private void Window_MouseEnter(object sender, MouseEventArgs e)
{
this.ShowTitleBar = false;
this.ShowCloseButton = false;
this.ShowMinButton = false;
this.ShowMaxRestoreButton = false;
}
Now, Add Following properties to the WPF window in xaml,
<Controls:metrowindow x:class="CP1038562.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
Title="MainWindow" ShowTitleBar="False" ShowMaxRestoreButton="False" ShowMinButton="False" ShowCloseButton="False" Height="350" Width="525" MouseEnter="Window_MouseEnter" BorderBrush="Blue" BorderThickness="2" MouseLeave="Window_MouseLeave">
</Controls:metrowindow>
Build & Run.