我正在研究WPF应用程序。我是新的WPF。我在我的应用程序中使用Listview显示如下图像: -
我的XAML是: -
<ListView x:Name="lstviewMeters" BorderThickness="1" Height="263" Margin="0,89,23,0" VerticalAlignment="Top" Width="597" AlternationCount="2" ItemsSource="{Binding}" HorizontalAlignment="Right">
<ListView.View>
<GridView >
<GridViewColumn Header="Feeder Name" Width="120" DisplayMemberBinding="{Binding MeterName}"/>
<GridViewColumn Header="ID" Width="120" DisplayMemberBinding="{Binding MeterID}"/>
<GridViewColumn Header="Status" Width="120" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Status}"/>
<Image Width="16" Height="16" Source="{Binding IconUri}"/>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="TimeStamp" Width="120" DisplayMemberBinding="{Binding TimeStamp}"/>
<GridViewColumn Header="Remark" Width="100" DisplayMemberBinding="{Binding Remark}"/>
</GridView>
</ListView.View>
</ListView>
我改变了默认滚动条的样式,以便为UI做好看,为此我创建了资源字典并在XAML中调用它。问题是垂直滚动条可见,但细胞内容扩展时不显示水平滚动。当我手动展开单元格时,它应该是可见的。 我已经为滚动条设置了以下属性,但仍无法正常工作
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Visible"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Visible"/>
任何人都可以有解决方案,以便始终可见VSCROLL和HSCROLL
提前致谢!
答案 0 :(得分:1)
使用ScrollViewer简单地包围ListView,如:
<ScrollViewer HorizontalScrollBarVisibility="Visible">
<ListView>.....</ListView>
</ScrollViewer>