-
Notifications
You must be signed in to change notification settings - Fork 476
Open
Labels
Description
I noticed when I was preparing my ListBox item template. I wanted to make entire ListBoxItem background to be ImageSourceBrush. But unfortunately by default the ListBox Item doesn't stretch the whole width and height.
Overriding the ItemContainerStyle will break the modern style of ListBox.
Any ideas how to stretch the grid to an entire ListBoxItem?
Code:
<ListBox ItemsSource="{Binding SongsList}" SelectedItem="{Binding CurrentSong}" Background="Black" Margin="0,5,0,0">
<ListBox.ItemTemplate>
<DataTemplate DataType="models:SongModel">
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Tag="{Binding SongLink}">
<Grid.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="{Binding Icon}" Opacity="0.5" RenderOptions.BitmapScalingMode="Fant"/>
</Grid.Background>
<TextBlock Text="{Binding Title}" TextTrimming="CharacterEllipsis"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>