2014-02-22 54 views
0

我想做一個帶圓角的簡單登錄表單。下面是具有以下形式的屏幕截圖:如何防止通過邊框顯示網格的底部邊緣

enter image description here

有一個在底部的線段;它是透明的。請告訴我如何改變我的XAML以擺脫這條線。

這是我的XAML:

<Window x:Class="Login" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
Title="Login" WindowStyle="None" AllowsTransparency="True" Background="Transparent" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="194" d:DesignWidth="358" SizeToContent="WidthAndHeight"> 
<Border BorderBrush="#9DE5F5" BorderThickness="4" CornerRadius="8" Width="343"> 
    <Grid Background="#9DE5F5" Width="337" ShowGridLines="False" > 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="108*" /> 
      <ColumnDefinition Width="286*" /> 
     </Grid.ColumnDefinitions> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="*" /> 
      <RowDefinition Height="*" /> 
      <RowDefinition Height="*" /> 
     </Grid.RowDefinitions> 
     <Grid.Resources> 
      <Style TargetType="{x:Type TextBlock}"> 
       <Setter Property="FontSize" Value="16" /> 
       <Setter Property="FontWeight" Value="DemiBold" /> 
       <Setter Property="VerticalAlignment" Value="Center" /> 
       <Setter Property="HorizontalAlignment" Value="Right" /> 
       <Setter Property="Padding" Value="8" /> 
       <Setter Property="Foreground" Value="Black" /> 
      </Style> 
      <Style TargetType="{x:Type TextBox}"> 
       <Setter Property="Margin" Value="5,10,15,5" /> 
       <Setter Property="FontSize" Value="16" /> 
      </Style> 
      <Style TargetType="{x:Type PasswordBox}"> 
       <Setter Property="Margin" Value="5,10,15,5" /> 
       <Setter Property="FontSize" Value="16" /> 
      </Style> 
     </Grid.Resources> 
     <TextBlock Grid.Column="0" Grid.Row="0" >Username:</TextBlock> 
     <TextBlock Grid.Column="0" Grid.Row="1" >Password:</TextBlock> 
     <TextBox Grid.Column="1" Grid.Row="0" Name="txtUserName" Background="White" /> 
     <PasswordBox Grid.Column="1" Grid.Row="1" Name="txtPassword" Background="White" PasswordChar="*" /> 
     <Button Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right" Margin="10,10,15,10" Width="80" FontWeight="Bold" FontSize="13" Background="SteelBlue">Login</Button> 
     <Button Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="10,20,5,10" Width="30" Background="Red" Foreground="White" >X</Button> 
    </Grid> 
</Border> 

回答

0

由於在Border的4PX邊界是相同的顏色,你應該剛剛擺脫它的Grid

如果它們是相同的顏色,通常會有一些可見的行,從邊界到實際背景的過渡發生在這種情況下。

我會通過設置在Border而不是GridBackground,並完全去除從BorderBorderThicknessBorderBrush性修復它。

看起來很細我的電腦上:-)

<Border Background="#9DE5F5" CornerRadius="8" Width="343"> 
    <Grid ShowGridLines="False"> 
    .... 
</Border> 
1

添加-1的利潤率是一個快速的技巧,但擺脫它。

<Grid Background="White" Width="337" ShowGridLines="False" Margin="-1"> 
相關問題