Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 仅显示活动时在列表框中水平滚动图像_C#_Wpf_Xaml_Listbox_Slider - Fatal编程技术网

C# 仅显示活动时在列表框中水平滚动图像

C# 仅显示活动时在列表框中水平滚动图像,c#,wpf,xaml,listbox,slider,C#,Wpf,Xaml,Listbox,Slider,我收集了一些图片,我需要创建一些类似于带子弹的旋转木马的东西 目前我有2个列表框 <ListBox Name="lb" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="0" ScrollViewer.HorizontalScrollBarVisibility="Auto" IsSynchronizedWithCurrentItem="True" ItemsPanel="{St

我收集了一些图片,我需要创建一些类似于带子弹的旋转木马的东西

目前我有2个
列表框

    <ListBox Name="lb" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="0" ScrollViewer.HorizontalScrollBarVisibility="Auto"
      IsSynchronizedWithCurrentItem="True"
      ItemsPanel="{StaticResource HorizontalItemsPanel}"
      ItemsSource="{Binding Source={StaticResource CharacterCollectionView}}" 
      ItemContainerStyle="{StaticResource CharacterContainerStyle}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Image Source="{Binding SelectedItem.Image, ElementName=lb1}"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
  </ListBox>

    <ListBox BorderThickness="0" Height="20" VerticalAlignment="Top" IsSynchronizedWithCurrentItem="True" Background="#66000000" Grid.Row="1" Name="lb1" ItemsSource="{Binding Source={StaticResource CharacterCollectionView}}">
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" />
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
        <ListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
                <Setter Property="Margin" Value="0" />
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="#FFFFFF"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
        </ListBox.ItemContainerStyle>
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Border Background="#4CFFFFFF" Width="6" Height="6" CornerRadius="3"></Border>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>

第一个列表框用于图像,第二个列表框用于项目符号更改图像。如果单击项目符号,图像将正确更改(在“更改”下,我的意思是将图像设置为“选定”,因为只有选定的项目可见)

但我也需要在不使用项目符号的情况下为幻灯片图像添加功能(当您可以通过触摸或水平滑动来滑动图像时)。目前,这仅在所有图像都可见时才起作用


只有选定项目可见时,如何对图像进行滑动?

您能提供一个html、css和javascript的最小示例来说明这个问题吗?@Locke125,它与html有什么关系?抱歉,我误读了您问题中的标记:)