2

我是silverlight的新手,我遇到的情况是在网格中我必须显示垂直线,下面我编写的代码显示虚线,但我需要实线。这个网格是在telerik RadGridView中声明的。

             <grid>
                 <Grid ShowGridLines="True">
                     <Grid.RowDefinitions>
                         <RowDefinition Height="20"/>
                     </Grid.RowDefinitions>
                     <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="170"/>
                          <ColumnDefinition Width="75"/>
                          <ColumnDefinition Width="75"/>
                          <ColumnDefinition Width="18"/>
                          <ColumnDefinition Width="55"/>

                          <ColumnDefinition Width="75"/>
                          <ColumnDefinition Width="75"/>
                          <ColumnDefinition Width="18"/>
                          <ColumnDefinition Width="55"/>
                     </Grid.ColumnDefinitions>

      <!--<Border Grid.Row="0" Grid.Column="0" BorderThickness="1" BorderBrush="White"></Border>-->
      <TextBlock Grid.Row="0" Grid.Column="0"  Text="" HorizontalAlignment="Left" VerticalAlignment="Center"/>

      <TextBlock Grid.Row="0" Grid.Column="1"  Text="" HorizontalAlignment="Left" VerticalAlignment="Center"/>
       <TextBlock Grid.Row="0" Grid.Column="2"  Text=""  HorizontalAlignment="Left" VerticalAlignment="Center"/>
        <Image Source="" Width="15" Height="15" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center"></Image>
         <TextBlock Grid.Row="0" Grid.Column="4"  Text="" HorizontalAlignment="Center" VerticalAlignment="Center"/>
        <TextBlock Grid.Row="0" Grid.Column="5"  Text="" HorizontalAlignment="Left" VerticalAlignment="Center"/>
        <TextBlock Grid.Row="0" Grid.Column="6"  Text="" HorizontalAlignment="Left" VerticalAlignment="Center"/>
        <Image Source="" Width="15" Height="15" Grid.Row="0" Grid.Column="7" HorizontalAlignment="Left" VerticalAlignment="Center"></Image>
         <TextBlock Grid.Row="0" Grid.Column="8"  Text="" HorizontalAlignment="Center" VerticalAlignment="Center"/>


  </Grid>

我使用了边框,但它在列定义之后,但每行边框都在应用我只想要一条实线而不是虚线或使用边框或矩形控件。请任何人都可以为我提供解决方案。

谢谢

哈拉维尔

4

1 回答 1

0

我认为您想要做的是用边框包裹每个文本块/图像。

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="20" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="170" />
        <ColumnDefinition Width="75" />
        <ColumnDefinition Width="75" />
        <ColumnDefinition Width="18" />
        <ColumnDefinition Width="55" />

        <ColumnDefinition Width="75" />
        <ColumnDefinition Width="75" />
        <ColumnDefinition Width="18" />
        <ColumnDefinition Width="55" />
    </Grid.ColumnDefinitions>

    <!--<Border Grid.Row="0" Grid.Column="0" BorderThickness="1" BorderBrush="White"></Border>-->
    <Border BorderThickness="1,0,1,0"
            BorderBrush="Black">
        <TextBlock Text=""
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center" />
    </Border>
    <Border BorderThickness="0,0,1,0"
            BorderBrush="Black"
            Grid.Column="1">
        <TextBlock Text=""
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center" />
    </Border>
    <Border BorderThickness="0,0,1,0"
            BorderBrush="Black"
            Grid.Column="2">
        <TextBlock Text=""
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center" />
    </Border>
    <Border BorderThickness="0,0,1,0"
            BorderBrush="Black"
            Grid.Column="3">
        <Image Width="15"
                Height="15"
                HorizontalAlignment="Left"
                VerticalAlignment="Center" />
    </Border>
    <Border BorderThickness="0,0,1,0"
            BorderBrush="Black"
            Grid.Column="4">
        <TextBlock Text=""
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center" />
    </Border>
    <Border BorderThickness="0,0,1,0"
            BorderBrush="Black"
            Grid.Column="5">
        <TextBlock Text=""
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center" />
    </Border>
    <Border BorderThickness="0,0,1,0"
            BorderBrush="Black"
            Grid.Column="6">
        <TextBlock Text=""
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center" />
    </Border>
    <Border BorderThickness="0,0,1,0"
            BorderBrush="Black"
            Grid.Column="7">
        <Image Width="15"
                Height="15"
                HorizontalAlignment="Left"
                VerticalAlignment="Center" />
    </Border>
    <Border BorderThickness="0,0,1,0"
            BorderBrush="Black"
            Grid.Column="8">
        <TextBlock Text=""
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center" />
    </Border>


</Grid>

结果:

http://i.imgur.com/niMWZ.png

于 2012-12-04T18:55:27.263 回答