我正在尝试使用ModernUI窗口元素,并坚持使用第一个元素的上边距(放置渐变的位置)。我使用现代 UI 灯光样式。设置零边距不起作用。
如何重新定义样式/减少上边距?
我的窗口视图
查看 xaml 部分:
<mui:ModernWindow x:Class="MyProject.Views.LoginWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
Height="380" Width="300">
<Grid Style="{StaticResource ContentRoot}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="2*" />
<RowDefinition Height="2*" />
<RowDefinition Height="30" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Label Grid.Row="0"
Content="ВХОД В СИСТЕМУ"
FontWeight="Bold" FontSize="20"
VerticalAlignment="Top"
Margin="5"/>
...
</Grid>
终于想通了。
问题出在引用的程序集 FirstFloor.ModernUI.dll。
我的项目目标框架是 4.5,我通过 Nuget 包管理器安装了新版本的 ModernUI。之后,安装的版本是1.0.6.0。
当我将引用更改为以前的版本 1.0.5.0 时,问题消失了,现在所有窗口元素都适合它们。
并且还消失了所有xaml警告,例如:无法解析资源。