1

私は WPF を使い始めたばかりで、スクロール可能なリストを作成する方法がわかりません。カスタムオブジェクトをその中に入れて、横にスクロールできるようにしたいです。

どこから始めればよいか考えている人はいますか?

4

1 に答える 1

1

スクロールを水平方向に作成するのListBoxは非常に簡単です。

<ListBox Margin="20">
  <ListBox.ItemsPanel>
    <ItemsPanelTemplate>
      <!-- If you need Virtualization then check up on that topic accordingly and you'd need to switch the following StackPanel to a VirtualizingStackPanel -->
      <StackPanel Orientation="Horizontal" />
    </ItemsPanelTemplate>
  </ListBox.ItemsPanel>
  <ListBoxItem Content="Something A" />
  <ListBoxItem Content="Something B" />
  <ListBoxItem Content="Something C" />
  <ListBoxItem Content="Something D" />
  <ListBoxItem Content="Something E" />
  <ListBoxItem Content="Something F" />
</ListBox>

カスタムオブジェクト部分に関しては、まず、これらのListBoxようなコントロールを操作するいくつかの基本的な例を試してみてください。

その後、ほとんどの場合、カスタム オブジェクトのコレクションをそれListBoxを介してバインドし、カスタム オブジェクトを視覚化するのに役立つ を xaml で定義します。ItemSourceDataTemplate

その ^^ ステートメント ( BindingItemSourceDataTemplate) のほとんどすべての技術的な単語は、最初に理解したいと思います。新しいものではなく、検索するだけでそれぞれの広範なヘルプを見つけることができます。

于 2013-07-06T17:17:29.037 に答える