Vác*_*ych 3 .net xaml windows-phone-7
我不知道为什么这段代码工作正常:
<ScrollViewer Height="674" HorizontalAlignment="Left" VerticalAlignment="Top" Width="480" Margin="0,94,0,0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<StackPanel>
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
</StackPanel>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)
这不是:
<ScrollViewer Height="674" HorizontalAlignment="Left" VerticalAlignment="Top" Width="480" Margin="0,94,0,0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ListBox Width="480" ItemsSource="{Binding ViewModel_ObservableCollection_Property_With_15_Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="85">
<Button Content="custom control" VerticalAlignment="Center" Width="480" Height="70" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)
ListBox版本无法显示ScrollViewer中的所有项目.诀窍是什么?
您应该避免使用ScrollViewer来包装ListBox,因为在默认的ListBox样式中已经存在ScrollViewer.
| 归档时间: |
|
| 查看次数: |
1063 次 |
| 最近记录: |