在Silverlight中将网格网格线显示为不是虚线格式的实线

时间:2012-12-04 08:43:19

标签: asp.net silverlight-4.0 telerik

我是银光的新手我有这样的情况:在网格中我必须显示垂直线,下面的代码我写的显示虚线但我需要实线。这个网格是在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>

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

由于

Haraveer

1 个答案:

答案 0 :(得分: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