I have a list with a DataTemplate that shows the text and an "x" button next to it. I want the "X" btn to be displayed in the extreme right order, so they all appear in the same place. XML used by me:
<ListBox Name="seiveListBox" ItemsSource="{Binding}" MinWidth="80" Height="120" ScrollViewer.VerticalScrollBarVisibility="Visible" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding}" />
<Button Name="delSeiveFromListBtn" Content="X" ToolTip="Delete" Margin="8, 0, 0, 0" Click="delSeiveFromListBtn_Click"></Button>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
I tried adding a Grid inpalce from the StackPanel but was not successful.
How can I create it or align the "x" in the list, which is located in the far right corner of each element.
source
share