绑定图像使其水平滚动不起作用
本文关键字:滚动 不起作用 水平 图像 绑定 | 更新日期: 2023-09-27 18:01:11
刚刚开始学习c#和windows phone,我的问题我似乎无法让我的图像(绑定图像(显示并水平滚动,如果我在xaml中硬编码,我可以让它们工作,这是我的代码。。。
<!-- row 4 start -->
<Grid x:Name="row3" Grid.Row="3">
<ScrollViewer HorizontalScrollBarVisibility="Auto">
<StackPanel x:Name="imgStackPanel" Orientation="Horizontal" ScrollViewer.HorizontalScrollBarVisibility="Auto">
<!--<Image Source="{Binding Path=DvdPhoto}" Width="150" Height="150" Margin="5"/>-->
<Image Source="/GmanDVDStore;component/Images/rain.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/snow.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/sun.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/wind.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/rain.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/snow.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/sun.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/wind.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/rain.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/snow.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/sun.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/wind.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/rain.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/snow.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/sun.jpg" Width="150" Height="150" Margin="5"/>
<Image Source="/GmanDVDStore;component/Images/wind.jpg" Width="150" Height="150" Margin="5"/>
</StackPanel>
</ScrollViewer>
</Grid>
这项工作的图像显示出来,我可以从左到右滚动,我有图像绑定的注释代码不起作用。
如果我垂直做,它会很好,因为我有一个列表框,我已经尝试了水平列表框。
有人能解决这个问题吗。
提前感谢
Gman
附言:放轻松,正如我所说,我才刚刚开始学习windows手机。:(
如本问题的答案所述:
WP7-水平滚动列表框问题
您可以通过指定ScrollViewer 的宽度值来完成此操作
希望这会有所帮助。