none
两个相邻的控件或布局的边框如何设置颜色? RRS feed

  • 问题

  • 比如要在grid和另一个它挨在一起的DockPanel的相邻的边框设置颜色,或者在它们相邻的边框设置线条。要怎么做?
    2016年12月8日 13:14

答案

  • 你好,
    如果希望两个控件之间相邻的边框有颜色,可以试试下面的做法,将这两个控件不相邻的边框宽度设置为零:

    <Grid Name="grid1"> <Grid.RowDefinitions > <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid Grid.Row="0" Background="AliceBlue" Width="100" Height="100" VerticalAlignment="Bottom"> <Border BorderThickness="0,0,0,2" BorderBrush="Red"/> </Grid> <DockPanel Grid.Row="1" Background="Ivory" Width="100" Height="100" VerticalAlignment="Top"> <Border BorderThickness="0,2,0,0" BorderBrush="Red"/> </DockPanel> </Grid>

    效果图:

    Best Regards,

    Annievia Chen


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    2016年12月9日 3:32
    版主