ItemsControl にアイテムのセットがあります。それらすべてを表示していますが、項目のサブセットのみを表示したいと考えています。そこで、ItemsControl (またはこれをサポートする他の要素) の可視領域を指定したいと思います。スクロールが適用された後、他の要素が表示される可能性があります。
ViewModel 側で実行し、ItemsControl に可視要素のみを渡すこともできますが、View のみのソリューションに興味があります。ありますか?
ItemsControl にアイテムのセットがあります。それらすべてを表示していますが、項目のサブセットのみを表示したいと考えています。そこで、ItemsControl (またはこれをサポートする他の要素) の可視領域を指定したいと思います。スクロールが適用された後、他の要素が表示される可能性があります。
ViewModel 側で実行し、ItemsControl に可視要素のみを渡すこともできますが、View のみのソリューションに興味があります。ありますか?
ScrollViewer
のスタイルに aを追加すると、アイテムがa ScrollBarItemsControl
の幅または高さからはみ出す場合に表示されます。ItemsControl
<Style x:Key="ItemsControlStyle1" TargetType="{x:Type ItemsControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>