Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I set "VerticalScrollBarVisibility" of ListBox, but it does not work?

XML
<Style x:Key="ListBoxStyling3" TargetType="{x:Type ListBox}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ListBox}">
       <!--Set the VerticalScrollBarVisibility, When the vertical distance decreases, but the VerticalBar did not come out-->
                <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                    <WrapPanel IsItemsHost="True"/>
                </ScrollViewer>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="ItemTemplate">
        <Setter.Value>
            <DataTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="60"/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="140"/>
                    </Grid.ColumnDefinitions>
                    <Image Margin="2,2,2,1" Source="{Binding Path}" Width="48"/>
                    <TextBlock Grid.Row="1" Margin="5" HorizontalAlignment="Center" Text="{Binding Name}" FontWeight="Bold" FontSize="14"/>
                </Grid>
            </DataTemplate>
        </Setter.Value>
    </Setter>
Posted
Updated 7-Jun-10 1:50am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900