I would like to use a line in a MAUI project, and this is the documentation:
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/shapes/line?view=net-maui-7.0
But i would like, in an horizontal line, to set that automatically the line use all the space from left to right. I don't see stretch options like another controls.
I could set a very long length, for example 10000, but I would like to know if there is a better way.
Thanks.
To answer directly your question: since X2
is bindable, you can bind it to the width of itself:
<Line Stroke="Red" X2="{Binding Width, Source={RelativeSource Self}}" HorizontalOptions="Fill" StrokeThickness="3" />
My advice: MS has been using BoxView
or BorderView
for lines since forever, I guess it's better performance-wise as well. You should use the other solution instead unless you absolutely have to use Line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With