我有一个xaml页面,里面有一个带有两个列表框的网格。我希望网格滚动列表框,这是有效的,但只有我从列表框区域外滚动。我希望列表框将滚动传播到网格,因为它们本身没有任何滚动条。
这是我的代码:
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ListBox BorderBrush="Red" BorderThickness="2" Grid.Row="0" ItemsSource="{Binding Path=PinpadPaymentBrandControlList, ElementName=PbUserControl}" x:Name="RadioPbList"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionMode ="Single"
SelectionChanged="RadioPbList_SelectionChanged">
<ListBox.ItemTemplate >
...
</ListBox.ItemTemplate >
</ListBox>
<ListBox BorderBrush="Red" BorderThickness="2" Grid.Row="0" ItemsSource="{Binding Path=PinpadPaymentBrandControlList, ElementName=PbUserControl}" x:Name="RadioPbList"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionMode ="Single"
SelectionChanged="RadioPbList_SelectionChanged">
<ListBox.ItemTemplate >
...
</ListBox.ItemTemplate >
</ListBox>
</Grid>
</ScrollViewer>
我尝试使用ScrollViewer.CanContentScroll =&#34; True&#34;在ListBox标签中,但它也没有工作。 有帮助吗?我不习惯使用xaml所以我可能会做错了