1
<ListBox x:Name="lstbox" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Visible">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>

この設計時コードを使用して、水平方向にスクロールする画像のリストを作成できます。
現在、実行時に画像を追加できますが、実行時に
コードを介して同じ効果を生み出すことはできません....

4

1 に答える 1

3

1 つの方法:

        string xaml =
        "<ListBox x:Name='lstbox' ScrollViewer.VerticalScrollBarVisibility='Disabled' ScrollViewer.HorizontalScrollBarVisibility='Visible'>"+
        "<ListBox.ItemsPanel>"+
            "<ItemsPanelTemplate>"+
                "<StackPanel Orientation='Horizontal' />"+
            "</ItemsPanelTemplate>"+
        "</ListBox.ItemsPanel>";

UIElement tree = (UIElement)XamlReader.Load(xaml);

LayoutRoot.Children.Add(tree);
于 2012-10-04T14:57:17.857 に答える