首页 > 解决方案 > WPF 表单应用程序与设计器中的属性不同

问题描述

我正在学习如何使用 Visual Studio 2019 创建 wpf 控件(和窗口)。作为第一步,我尝试生成一个内部带有标签的窗口。使用以下代码,它看起来像这样(设计器窗口)

设计师

<Window x:Name="Ventana" x:Class="PhanUtils.Sistema.Recursos.Ventanas.Mensaje"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:local="clr-namespace:PhanUtils.Sistema.Recursos.Ventanas" 
    Width="580" Height="175" MinWidth="580" MinHeight="175" MaxWidth="580" MaxHeight="175"
    ScrollViewer.VerticalScrollBarVisibility="Disabled" 
    ResizeMode="NoResize"
    WindowStartupLocation="CenterScreen"
    HorizontalAlignment="Center">
    <Grid>
        <Label x:Name="L_Informacion" Content="Label" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="554" Height="126" BorderBrush="#FFCF1E1E" BorderThickness="5"/>
    </Grid>
</Window>

但是,当我运行应用程序并显示相同的对话框时,它看起来像这样:

应用

有人知道我为什么会遇到这个问题吗?

标签: c#wpfwpf-controls

解决方案


推荐阅读