覆盖边框的默认样式会使我的WPF窗口变圆

覆盖边框的默认样式会使我的WPF窗口变圆,wpf,border,rounded-corners,cornerradius,Wpf,Border,Rounded Corners,Cornerradius,我在app.xaml文件中将边框CornerRadius作为默认样式覆盖(如下所示) 在MainWindow.xaml文件中 <Window x:Class="BorderCornerProblem.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xa

我在app.xaml文件中将边框CornerRadius作为默认样式覆盖(如下所示)


MainWindow.xaml文件中

<Window x:Class="BorderCornerProblem.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">       
</Window>

结果是窗口具有黑色圆角

然后,我的问题是如何定义一个默认样式,其中角半径设置为边框,而不会弄乱我的窗口?

你真的不应该全局设置
边框
,它们无处不在

给样式一个键,只在需要的地方引用它。

你真的不应该全局设置
边框,它们无处不在


给样式一个键,只在需要的地方引用它。

所以你想更改一些边框样式,但不是全部?是的。我想为我在Xaml中明确使用的所有边框使用一种样式,所以您想更改一些边框样式,但不是全部?嗯,是的。我想为我在xamlI中明确使用的所有边界使用一种样式。我真的不喜欢你的答案,但它看起来很真实:(DataGrid也受我的边界样式的影响。我将使用propper样式进行我自己的控制。谢谢你的帮助我真的不喜欢你的答案,但它看起来很真实:(DataGrid也受Borders样式的影响。我将使用propper样式进行自己的控制。谢谢您的帮助
<Window x:Class="BorderCornerProblem.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">       
</Window>