I have listbox and I am placing some labels in it.
<ListBox x:Name="lstContacts">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<HyperlinkButton Height="30" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Content="{Binding PhoneType, Converter={StaticResource CntctConverter}}" Style="{StaticResource HyperlinkButtonStyle}"/>
<TextBlock Height="30" HorizontalAlignment="Left" Text="{Binding PhoneNumber}" Width="250" Foreground="{StaticResource TitleBrush}" Tap="lblMobile_Tap" VerticalAlignment="Top"/>
<TextBlock Height="30" Text="{Binding CallRate}" HorizontalAlignment="Right" Foreground="{StaticResource TitleBrush}" Margin="0,-30,0,0" VerticalAlignment="Top"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
My last label should come in extreme right as i made its horizontal alignment to right. But its coming to center. Please see snapshot
Please suggest where I am making any mistake
Your StackPanel width is 250 because of the first TextBox width value, so it looks like the second TextBlock is positoned correctly to the right.
You need to increase the width of the stackpanel by adding a Width value to it.