2

WPF ListBoxItem how to wrap text in it? My Item container style looks like this:

        <Style x:Key="GroupListBoxItemStyle"
           TargetType="ListBoxItem">
        <Setter Property="OverridesDefaultStyle"
                Value="True" />
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}" />
        <Setter Property="FontSize"
                Value="11" />
        <Setter Property="FontWeight"
                Value="Bold" />
        <Setter Property="Width"
                Value="95" />
        <Setter Property="HorizontalAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <SlidingBar:SlidingBarRadioButton GroupName="PermissionsRadioButtonGroup"
                                                      IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource TemplatedParent},BindsDirectlyToSource=True,Mode=TwoWay}"
                                                      Text="{Binding Converter={StaticResource resourceStringToResourceConverter}}"
                                                      ImageSource="{Binding Converter={StaticResource PermissionTypeToImageConverter}}" 
                                                      Margin="1"                                                          
                                                      />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

1 Answer 1

3

Make sure you set the following properties to the ListBox/ListView:

HorizontalContentAlignment="Stretch"

ScrollViewer.HorizontalScrollBarVisibility="Disabled"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.