I want a blue line stretch end listitem but only a few come.
I gave
HorizontalAlignment = "Stretch"
but it doesn't work.
Full list code here
<Grid>
<ListBox Name="MyListBoxAddData" Margin="20" BorderThickness="0">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Label Content="{Binding Id}"/>
<Label Content="{Binding Path=Questions,Mode=TwoWay}"/>
<RadioButton Content="{Binding Path=Option1,Mode=TwoWay}" Margin="10 5"/>
<RadioButton Content="{Binding Path=Option2,Mode=TwoWay}" Margin="10 5"/>
<RadioButton Content="{Binding Path=Option3,Mode=TwoWay}" Margin="10 5"/>
<RadioButton Content="{Binding Path=Option4,Mode=TwoWay}" Margin="10 5"/>
<TextBlock Text="{Binding Answer}" />
<Separator HorizontalContentAlignment="Stretch"/>
<Rectangle HorizontalAlignment="Stretch" Fill="Blue" Height="4" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
I want a full line. Thank you in Advance
Set the ListBox's HorizontalContentAlignment
property to Stretch
:
<ListBox Name="MyListBoxAddData" Margin="20" BorderThickness="0"
HorizontalContentAlignment="Stretch">
...
</ListBox>