开发者

How to wrap Text in a ListViewItem?

开发者 https://www.devze.com 2023-01-10 08:07 出处:网络
WPF ListBoxItem how to wrap text in it? My Item container style looks like this: <Style x:Key=\"GroupListBoxItemStyle\"

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>


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

HorizontalContentAlignment="Stretch"

ScrollViewer.HorizontalScrollBarVisibility="Disabled"

0

精彩评论

暂无评论...
验证码 换一张
取 消