Hi, I am binding a list of items to a ListBox, I need some help with XAML to be able to display a button for each item. I can display a button fine, however the button takes on the length of the content text. I want my button to consume 100% of the ListBox width. I also need to stop the row highlighting for the ListBox, as the button should do this itself.
I am using a button rather than drawing rectangles as I want to use Commands for click event on the Button.
<ListBox x:Name="MenuListBox"
ItemsSource="{Binding Path=MenuItemList}"
ScrollViewer.VerticalScrollBarVisibility="Visible">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="1">
<Button Content="{Binding Path=Name}"
Height="30"
FontSize="12"
FontWeight="Bold"
HorizontalAlignment="Stretch"
Command="{Binding Path=DataContext.GetChildrenCommand, Source={StaticResource spy}}"
CommandParameter="{Binding}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>