<Window x:Class="Main"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="">
<Window.Resources>
<x:ArrayExtension Type="{x:Type sys:String}" x:Key="items">
<sys:String>A</sys:String>
<sys:String>B</sys:String>
<sys:String>C</sys:String>
<sys:String>D</sys:String>
</x:ArrayExtension>
</Window.Resources>
<ListBox ItemsSource="{StaticResource items}" Width="120" Height="67">
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border BorderThickness="1" BorderBrush="Black" CornerRadius="10">
<ScrollViewer>
<ScrollViewer.Clip>
<RectangleGeometry Rect="0, 0, 100, 50"></RectangleGeometry>
</ScrollViewer.Clip>
<VirtualizingStackPanel IsItemsHost="True" />
</ScrollViewer>
</Border>
</ControlTemplate>
</ListBox.Template>
</ListBox>
</Window>
|