Silverlight stretch child to fill parent container?

In Silverlight, how can I stretch the width of the line to fill the width of the StackPanel in which it is a child? Prefer a XAML solution rather than code. Here is how I can do this in WPF:

<Line X1="0" 
      X2="{Binding Path=ActualWidth, ElementName=HolePatternStackPanel}" 
      Stroke="Gray" 
      StrokeThickness="1" />

But this does not work in Silverlight.

+3
source share
3 answers
<Line X1="0" Y1="0" X2="0" Y2="1" Stretch="Fill" Stroke="#FF000000" />

Works in both WPF and Silverlight.

If X is 0, this is a vertical line. If Y is 0, then it is horizontal. Use X1 = 0 Y1 = 0 X2 = 1 Y2 = 1 for diagonals from upper left to lower right or flip it in the lower left upper right corner.

Cheerful fresh.

+7

Silverlight.net sladapter :

Silverlight .

Line? , Rectangle ( 2 px), HorizontalAlignment = "Stretch", .

.

+2

ElementBinding Silverlight 4. , . , , - , .

+1

Source: https://habr.com/ru/post/1704335/


All Articles