Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么有些文字是粗体的?_C#_Wpf_Xaml - Fatal编程技术网

C# 为什么有些文字是粗体的?

C# 为什么有些文字是粗体的?,c#,wpf,xaml,C#,Wpf,Xaml,因此,我正在构建一个WPF安装程序,我有两个单选按钮,用于安装和卸载: 以下是每个按钮的XAML,仅供参考: 安装按钮: <RadioButton Content="Install" HorizontalAlignment="Left" Margin="42,90,0,0" VerticalAlignment="Top" FontSize="18" RenderTransformOrigin="0.591,2.133" FontFamily="Microsoft Sa

因此,我正在构建一个WPF安装程序,我有两个单选按钮,用于安装和卸载:

以下是每个按钮的XAML,仅供参考:

安装按钮:

<RadioButton Content="Install" HorizontalAlignment="Left" 
    Margin="42,90,0,0" VerticalAlignment="Top" FontSize="18" 
    RenderTransformOrigin="0.591,2.133" FontFamily="Microsoft Sans Serif"/>
<RadioButton Content="Uninstall" HorizontalAlignment="Left" 
    Margin="42,138,0,0" VerticalAlignment="Top" FontSize="18" 
    RenderTransformOrigin="0.591,2.133" FontFamily="Microsoft Sans Serif"/>

卸载按钮:

<RadioButton Content="Install" HorizontalAlignment="Left" 
    Margin="42,90,0,0" VerticalAlignment="Top" FontSize="18" 
    RenderTransformOrigin="0.591,2.133" FontFamily="Microsoft Sans Serif"/>
<RadioButton Content="Uninstall" HorizontalAlignment="Left" 
    Margin="42,138,0,0" VerticalAlignment="Top" FontSize="18" 
    RenderTransformOrigin="0.591,2.133" FontFamily="Microsoft Sans Serif"/>

从代码中可以看出,按钮基本相同,只是一个表示安装,另一个表示卸载,它们的位置不同。但是,当程序运行时,我得到以下结果:

关于为什么要使卸载按钮变为粗体,以及我如何解决这个问题,有什么想法吗

编辑:如果您感兴趣,这里是该程序的全部代码。我没走多远就注意到了这个问题:

<Window x:Class="Installer.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:Installer"
        mc:Ignorable="d"
        Title="Tic-Tac-Toe Installer" Height="283.159" Width="529.765">
    <Grid Margin="0,0,2,2">
        <RadioButton Content="Install" HorizontalAlignment="Left" Margin="42,90,0,0" VerticalAlignment="Top" FontSize="18" RenderTransformOrigin="0.591,2.133" FontFamily="Microsoft Sans Serif"/>
        <Label Content="Please select to install or uninstall Tic-Tac-Toe." Margin="27,23,-75,0" VerticalAlignment="Top" FontFamily="Microsoft Sans Serif" FontSize="22" Width="475" HorizontalAlignment="Left"/>
        <Button Content="Cancel" HorizontalAlignment="Left" Height="28" Margin="427,214,-60,-37" VerticalAlignment="Top" Width="75" FontFamily="Microsoft Sans Serif" FontSize="16"/>
        <Button Content="Next" HorizontalAlignment="Left" Height="28" Margin="331,214,0,0" VerticalAlignment="Top" Width="75" FontFamily="Microsoft Sans Serif" FontSize="16" RenderTransformOrigin="-0.734,0.499"/>
        <RadioButton Content="Uninstall" HorizontalAlignment="Left" Margin="42,138,0,0" VerticalAlignment="Top" FontSize="18" RenderTransformOrigin="0.591,2.133" FontFamily="Microsoft Sans Serif"/>

    </Grid>
</Window>

结果如下:


现在,您可能会注意到,在这个图像中,所有的文本都是粗体的。而以前,只有标题(“请选择安装或卸载Tic-Tac-Toe”)和卸载文本是粗体的,但我没有改变任何东西

文本不是粗体。它的大小比我们在UI中使用的要大


要使文本的大小为常规大小,请完全删除FontSize属性。

文本不是粗体。它的大小比我们在UI中使用的要大


要使文本大小为常规大小,请完全删除FontSize属性。

我相信某些设置应用于它们的父项会导致差异。请回答您的问题并说明这些按钮的位置您确定没有重复的“卸载”按钮标签吗?当两个完全相同的文本块相互重叠时,有时会发生这种情况。@Impworks不,没有额外的卸载按钮,更有趣的是,现在安装按钮是粗体的,我没有更改任何内容!查看整个代码和结果的编辑。@Camiloterivento我不这么认为,但我确实上传了我所有的代码和结果。如果您不能提供两个显示这两个结果的代码示例,我们将无能为力。现在的情况我们只能猜测。另外:文本不粗体;它的大小只是比UI中通常使用的要大。我相信他们的父母身上应用了一些设置,造成了这种差异。请回答您的问题并说明这些按钮的位置您确定没有重复的“卸载”按钮标签吗?当两个完全相同的文本块相互重叠时,有时会发生这种情况。@Impworks不,没有额外的卸载按钮,更有趣的是,现在安装按钮是粗体的,我没有更改任何内容!查看整个代码和结果的编辑。@Camiloterivento我不这么认为,但我确实上传了我所有的代码和结果。如果您不能提供两个显示这两个结果的代码示例,我们将无能为力。现在的情况我们只能猜测。另外:文本不粗体;它的大小只是比UI中通常使用的要大。