use*_*735 10 wpf itemscontrol horizontal-scrolling
如何添加滚动条,让我滚动水平显示的项目?
<ItemsControl ItemsSource="{Binding Data, ElementName=myWindows}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal">
</VirtualizingStackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="FrameworkElement" >
<Setter Property="Margin" Value="10,0,10,0"></Setter>
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
Fed*_*gui 23
<ItemsControl ItemsSource="{Binding Data, ElementName=myWindows}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<!-- Add this Template -->
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<ScrollViewer HorizontalScrollBarVisibility="Visible">
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<!-- ... Etc ... -->
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4172 次 |
| 最近记录: |