0
當我在WrapPanel
中設置ListView.ItemsPanel
時,右側滾動條丟失(不可見)。內容通過鼠標滾輪進行滾動,當然在此scrollviewer中研究可視化樹的所有屬性都已正確安裝。這裏有什麼可能是錯的,爲什麼他不可見。wpf listview itempanel scrollviewer
<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>
這是截圖: