<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>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)