Xaml 如何使用ItemsRepeater手动滚动
我正在使用ItemsRepeater。并使用ScrollViewer向左/向右滚动 由于某些原因,我必须禁用ScrollViewer的水平滚动模式,并将左/右按钮添加到手动滚动 xaml是Xaml 如何使用ItemsRepeater手动滚动,xaml,uwp,uwp-xaml,Xaml,Uwp,Uwp Xaml,我正在使用ItemsRepeater。并使用ScrollViewer向左/向右滚动 由于某些原因,我必须禁用ScrollViewer的水平滚动模式,并将左/右按钮添加到手动滚动 xaml是 <Grid> <muxc:ItemsRepeaterScrollHost Margin="12" Loaded="ItemsRepeaterScrollHost_Loaded"> <Scrol
<Grid>
<muxc:ItemsRepeaterScrollHost Margin="12" Loaded="ItemsRepeaterScrollHost_Loaded">
<ScrollViewer
x:Name="sss"
VerticalScrollBarVisibility="Hidden"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollMode="Disabled"
HorizontalScrollMode="Disabled">
<muxc:ItemsRepeater
x:Name="HorizontalRepeater"
ItemsSource="{x:Bind product}"
ItemTemplate="{StaticResource HorizontalTemplate}">
<muxc:ItemsRepeater.Layout>
<muxc:StackLayout Orientation="Horizontal" Spacing="12"/>
</muxc:ItemsRepeater.Layout>
</muxc:ItemsRepeater>
</ScrollViewer>
</muxc:ItemsRepeaterScrollHost>
<Button
x:Name="ButtonLeft"
Tapped="ButtonLeft_Tapped">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" FontSize="18" />
</Button>
<Button x:Name="ButtonRight"
Tapped="ButtonRight_Tapped">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" FontSize="18" />
</Button>
</Grid>
什么也没发生。
为什么,谢谢
如何使用ItemsRepeater手动滚动
对于我的测试,ChangeView无法用于ItemsRepeater,请尝试将其替换为或方法
更新
将操作系统更新到最新版本1909之后,ChangeView工作正常,这可能是以前版本中的问题。你的应用程序的目标最低版本是什么?你已经禁用了ScrollViewer HorizontalScrollMode,为什么要使用horizontalOffset调用ChangeView?因为我将HorizontalScrollMode值设置为禁用,因此可以阻止鼠标滚轮。并使用ChangeView手动更改ScrollViewer的水平偏移量。他还将ScrollMode值设置为禁用,并使用ChangeView。谢谢,伙计。我将把它报告为WinUI的bug。链接:
sss.ChangeView(step, null, null);