首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >水平ItemsControl滚动

水平ItemsControl滚动
EN

Stack Overflow用户
提问于 2013-08-06 17:13:56
回答 1查看 5.1K关注 0票数 10

如何添加滚动条,让我在水平显示的项目中滚动?

代码语言:javascript
复制
   <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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-06 17:18:27

代码语言:javascript
复制
<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>
票数 27
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18086434

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档