当我设置然后右滚动条丢失(不可见)ListView.ItemsPanel
。WrapPanel
并且内容是通过鼠标滚轮滚动的,当然,通过研究此滚动查看器中的可视化树,所有属性都已正确安装。这里可能有什么问题以及为什么他不可见。
<Style TargetType="{x:Type ListView}">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<WrapPanel Background="Transparent" MouseDown="WrapPanel_MouseDown_1"
IsItemsHost="True"
Width="{Binding Path=ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ScrollContentPresenter}}}">
</WrapPanel>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Path Fill="{Binding ElementName=tBlock, Path=Foreground}" Width="20" Height="20" Margin="5, 0, 0, 0" Stretch="Uniform" Data="{Binding SmallIcon}" />
<TextBlock Margin="5, 4, 5, 0" x:Name="tBlock" Grid.Column="1" TextWrapping="Wrap" Width="200" Text="{Binding Name}"></TextBlock>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
这是屏幕截图: