DataTemplate
-
I've got this datatemplate for a listbox or combobox. How can I make the red grid be as large as the item; at the moment it shrinks down to the size of the textblock.
<DataTemplate x:key="DataTemplate2"> <Grid Background="#FFFF0000" > <TextBlock Text="{Binding}" /> </Grid> </DataTemplate>
-
I've got this datatemplate for a listbox or combobox. How can I make the red grid be as large as the item; at the moment it shrinks down to the size of the textblock.
<DataTemplate x:key="DataTemplate2"> <Grid Background="#FFFF0000" > <TextBlock Text="{Binding}" /> </Grid> </DataTemplate>
You can give the ListBoxItem or ComboBoxItem a style through the ItemsControl.ItemContainerStyle property. In that style, set the HorizontalContentAlignment property to Stretch.
-
You can give the ListBoxItem or ComboBoxItem a style through the ItemsControl.ItemContainerStyle property. In that style, set the HorizontalContentAlignment property to Stretch.