0

我通过以下代码填充列表框:

<ListBox Height="188" HorizontalAlignment="Left" Margin="277,0,0,0" Name="listBoxAtributeValue" VerticalAlignment="Top" Width="191" MaxHeight="188" MaxWidth="191">
        <ItemsControl ItemsSource="{Binding Path=.}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <StackPanel.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="Black" Offset="0" />
                                <GradientStop Color="#FFFFA029" Offset="1" />
                            </LinearGradientBrush>
                        </StackPanel.Background>
                            <Label Content="{Binding lblText}" />
                            <TextBox Text="{Binding txtBoxContent}" />
                    </StackPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </ListBox>

但我无法滚动它。这是列表框的图像:这里

我该如何解决?谢谢你。

4

1 回答 1

1

你不需要你的ItemsControl内部ListBox。AListBox已经是ItemsControl.

于 2012-07-16T10:31:53.343 回答