I'm brand new to WPF after using WinForms for years. I'm trying to get a window that looks like a typical windows form with the blue border and red close button, or really anything that has a border like it shows in the middle 2 windows of the Microsoft Docs. This is for .Net framework up to 4.8.1 but I am using .net 6.
but my app always shows with no border:
Here is my MainWindow.xaml:
<Window x:Class="Sim.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:Sim"
mc:Ignorable="d"
Title="Simulator" Height="650" Width="1000"
Icon="Resources/Sim.ico"
WindowStyle="SingleBorderWindow">
<Grid>
<Button x:Name="Power" Content="Power" HorizontalAlignment="Left" Margin="84,84,0,0" VerticalAlignment="Top" Click="OnPowerClick"/>
</Grid>
</Window>
I tried to add WindowChrome after WindowStyle="SingleBorderWindow">
<Setter Property="shell:WindowChrome.WindowChrome">
</Setter>
but I get the error "WindowChrome is not supported in a Windows Presentation Foundation (WPF) project."
Is there a way to get an older style border in .net 6 wpf?