Silverlight中Grid如何显示边框线

 我来答
百度网友96ffcf7
推荐于2016-11-25 · 知道合伙人互联网行家
百度网友96ffcf7
知道合伙人互联网行家
采纳数:22719 获赞数:118741
从事多年网络方面工作,有丰富的互联网经验。

向TA提问 私信TA
展开全部

使用手工定义的方式实现显示Grid边框线

<UserControl
    x:Class="SilverlightApplicationGridBorderSample.MainPage"
    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"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    <Grid
        x:Name="LayoutRoot"
        Background="White">
        
        <Grid.Resources>
            <Style
                TargetType="TextBlock">
                <Setter
                    Property="FontSize"
                    Value="30"></Setter>
                <Setter
                    Property="VerticalAlignment"
                    Value="Center"></Setter>
            </Style>
            <Style
                TargetType="Border">
                <Setter
                    Property="BorderBrush"
                    Value="LightGray"></Setter>
                <Setter
                    Property="BorderThickness"
                    Value="1"></Setter>
            </Style>
        </Grid.Resources>
        
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <TextBlock
            Text="左上角"></TextBlock>
        <TextBlock
            Text="左下角"
            Grid.Row="1"></TextBlock>
        <TextBlock
            Text="右上角"
            Grid.Column="1"></TextBlock>
        <TextBlock
            Text="右下角"
            Grid.Row="1"
            Grid.Column="1"></TextBlock>
        
        <!--添加4个边框-->
        <Border></Border>
        <Border
            Grid.Row="1"></Border>
        <Border
            Grid.Column="1"></Border>
        <Border
            Grid.Row="1"
            Grid.Column="1"></Border>
    </Grid>

isoboy
2011-10-20 · TA获得超过514个赞
知道答主
回答量:55
采纳率:0%
帮助的人:42.9万
展开全部
ShowGridLines = "True"
或者加个Border
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
anye6488
2011-10-22
知道答主
回答量:4
采纳率:0%
帮助的人:6199
展开全部
Grid本身没有边框
你可以在Grid外套上一个border
追问
如果我里面需要边框呢?而且是那种单元格合并了得那种,有没有简单的方法?我知道一个一个Border放也是可以的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式