在表单中使用wpf会被截断

时间:2017-10-18 08:28:36

标签: .net wpf forms xaml

我是WPF的新手,我正在为GUI创建速度表,我从不同的站点详细说明了XAML代码并获得了以下内容:

screenshot

一旦我将其包含在使用表单构建的GUI中,就会切断侧面。无论我如何修改边距或尺寸。

我相信我可以使用行和列来解决它,这里是代码XAML:

<UserControl x:Class="GuiTest1.UserControl1"
         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:ed="http://schemas.microsoft.com/expression/2010/drawing"           
         xmlns:local="clr-namespace:GuiTest1"
         mc:Ignorable="d" 
          Height="238.052" Width="288.042">


<Grid Background="#FF2E2F45" Margin="0,0,0.6,0.8">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" MinHeight="238"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="0*"/>
        <ColumnDefinition Width="288"/>
        <ColumnDefinition Width="0"/>
        <ColumnDefinition Width="Auto" MinWidth="1.6"/>
    </Grid.ColumnDefinitions>
    <ed:Arc Grid.Row="0" StartAngle="-120" EndAngle="120" Stretch="None" StrokeThickness="18"      
                StrokeDashArray=".25" Stroke="#FF484D5F" Grid.ColumnSpan="3" Margin="0,0,0,1.4" />
    <ed:Arc Grid.Row="0" StartAngle="-120" EndAngle="{Binding EndAngle}" Stretch="None" StrokeThickness="18"
                StrokeDashArray=".25" Stroke="Turquoise" Grid.ColumnSpan="3" Margin="0,0,0,1.4" />
    <TextBlock HorizontalAlignment="Left" Height="48" Margin="109,126,0,0" Foreground="White" TextWrapping="Wrap" Text="44" VerticalAlignment="Top" Width="74" FontSize="26" Grid.Column="2"/>
    <TextBlock HorizontalAlignment="Left" Margin="146,126,0,85.4" Foreground="White"  TextWrapping="Wrap" Text="m/s" Width="80" FontSize="16" Grid.Column="2"/>


</Grid>

这是我运行时的样子: enter image description here 有人能给我一些线索吗?

0 个答案:

没有答案