silverlight   发布时间:2022-05-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了silverlight – 在纯XAML中,是否可以使一条线与网格的一部分对齐?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

是否可以在XAML中创建一个Line(后面没有任何C#代码)来对齐一个布局容器(如Grid)中的一行? 我想有效地: <Grid> <Line StrokeThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="bottom" Stroke="Red"/>
是否可以在XAML中创建一个Line(后面没有任何C#代码)来对齐一个布局容器(如Grid)中的一行?

我想有效地:

<Grid>
    <Line strokeThickness="1" 
          HorizontalAlignment="Stretch" 
          VerticalAlignment="Bottom" 
          stroke="Red"/>
</Grid>

我需要使用strokeDashArray和strokeDashOffset,否则我只会使用BorderThickness设置为“0,1”的Border控件…

谢谢你的任何想法!

解决方法

要详细说明kanchirk的回应,这对我有用:

<Path strokeThickness="1"
 HorizontalAlignment="Stretch"  
 VerticalAlignment="Bottom"
 Data="M0,0 L1,0"
 Stretch="Fill"
 strokeEndLineCap="Square"
 strokeStartLineCap="Square"
 stroke="Red"/>

你也可以用Line做同样的事情:

<Line strokeThickness="1" 
 HorizontalAlignment="Stretch"   
 VerticalAlignment="Bottom" 
 X2="1" 
 Stretch="Fill" 
 strokeEndLineCap="Square" 
 strokeStartLineCap="Square" 
 stroke="Red"/>

大佬总结

以上是大佬教程为你收集整理的silverlight – 在纯XAML中,是否可以使一条线与网格的一部分对齐?全部内容,希望文章能够帮你解决silverlight – 在纯XAML中,是否可以使一条线与网格的一部分对齐?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。