gpt4 book ai didi

silverlight - 在纯 XAML 中,是否可以使一条线与网格的一部分对齐?

转载 作者:行者123 更新时间:2023-12-03 00:45:35 25 4
gpt4 key购买 nike

是否可以在 XAML 中创建一条线(后面没有任何 C# 代码)来对齐布局容器(例如网格)内的线?

我想有效地拥有:

<Grid>
<Line StrokeThickness="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Stroke="Red"/>
</Grid>

我需要使用 StrokeDashArrayStrokeDashOffset,否则我只需使用 Border 控件,并将 BorderThickness 设置为 "0 ,0,0,1"...

感谢您的任何想法!

最佳答案

为了详细说明 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 中,是否可以使一条线与网格的一部分对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2430610/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com