2

表示されているアイテムだけでなく、リストボックス内のすべてのアイテムをロードするにはどうすればよいですか? 基本的に、リストボックスの仮想化をオフにするにはどうすればよいでしょうか? 試しましたが、何も機能しませんでした。

            <ListBox x:Name="listBox1" VirtualizingStackPanel.IsVirtualizing="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" Background="Black" BorderThickness="0" IsEnabled="False" ForceCursor="True">
                <ListBox.RenderTransform>
                    <TranslateTransform x:Name="listBoxTransform" />
                </ListBox.RenderTransform>
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel x:Name="wp" IsItemsHost="True" ItemHeight="244" ItemWidth="184" Width="1700">
                        </WrapPanel>                            
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate DataType="{x:Type Image}" x:Name="dtName">
                        <!-- The Image binding -->
                        <Image Width="170" Height="230" Source="{Binding}" Stretch="Fill" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ListBox> 
4

3 に答える 3

3

このコードを使用してください(あなたのものから変更されたもの)

        <ListBox x:Name="listBox1" VirtualizingStackPanel.IsVirtualizing="False"
                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                  ScrollViewer.CanContentScroll="False"
                  Background="Black" BorderThickness="0" IsEnabled="False"
                  ForceCursor="True">
            <ListBox.RenderTransform>
                <TranslateTransform x:Name="listBoxTransform" />
            </ListBox.RenderTransform>
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel x:Name="wp" IsItemsHost="True" ItemHeight="244" ItemWidth="184" Width="1700">
                    </WrapPanel>                            
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate DataType="{x:Type Image}" x:Name="dtName">
                    <!-- The Image binding -->
                    <Image Width="170" Height="230" Source="{Binding}" Stretch="Fill" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ListBox> 

VirtualizingStackPanel.IsVirtualizing を False に変更し (以前の回答で提案されているように)、ScrollViewer.CanContentScroll="False" を追加しました。項目から項目へとジャンプすることは、小さなステップで進みます)。

これで問題が解決することを願っています。

于 2013-01-01T00:48:12.210 に答える
0
<ListBox VirtualizingStackPanel.IsVirtualizing="False" 
                       ItemsSource="{Binding XPath=Team}" 
                       ItemTemplate="{DynamicResource NameDataStyle}"/>
于 2012-12-31T23:23:50.797 に答える
0

が指定/使用される場所であるため、をオーバーライドする必要がありますItemsPanel(具体的には、 new を提供します)。ItemsPanelTemplateVirtualizingStackPanel

このようなもの:

<ListBox>
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel/>
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
</ListBox>
于 2012-12-31T23:25:52.503 に答える