I cannot get a ListBoxItem control template to wrap properly for the life of me. I made a TextBlock with TextWrapping=Wrap and put the ContentPresenter as its Child... tried several variations but none work. Any ideas? Thanks
<Style x:Key="SerialNumberButtonListBoxStyle" TargetType="ListBox" BasedOn="{StaticResource ButtonListBoxStyle}">
<Style.Resources>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Button -->
<Image
x:Name="image"
Source="Resources/Images/Buttons/76x76RoundedBlue.png"
Width="76"
Height="76"
Margin="2"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<!-- ContentPresenter for the text -->
<TextBlock
Style="{StaticResource White18PointTextStyle}"
Grid.Column="1"
TextWrapping="Wrap"
FontSize="18"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="10,2,50,2"
>
<ContentPresenter />
</TextBlock>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Selector.IsSelected" Value="True">
<Setter TargetName="image" Property="Source" Value="Resources/Images/Buttons/76x76RoundedGreenGlass.png" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Style.Resources>
</Style>