本文介绍了如何在Wpf中的Datagrid中显示水平滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以帮助我,你的答案非常受欢迎。
问题:只有点击datagrid的右上角才会显示水平滚动条。但是想要一直显示它而不点击任何地方。
以下是我的代码
Hi,
Can any one help me, your answers is heartly appreciated.
Problem: Horizontal scroll bar only display if I click on upper right corner of datagrid. But want to display it all the time without clicking anywhere.
Following are my code
<Window>
<Grid>
<GroupBox>
<StackPanel>
<DataGrid HorizontalAlignment="Center" AutoGenerateColumns="False"
ScrollViewer.CanContentScroll="True"
ScrollViewer.IsDeferredScrollingEnabled="True"
ScrollViewer.HorizontalScrollBarVisibility="Visible" >
<DataGrid.Columns>
//Some Columns here
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</GroupBox>
</Grid>
</Window>
推荐答案
<Grid>
<GroupBox>
<StackPanel Orientation="Horizontal" >
<ScrollViewer Width="500" ScrollViewer.VerticalScrollBarVisibility="Auto" Foreground="Red">
<DataGrid HorizontalAlignment="Center" AutoGenerateColumns="False" >
<DataGrid.Columns>
</DataGrid.Columns>
</DataGrid>
</ScrollViewer>
</StackPanel>
</GroupBox>
</Grid>
如有问题请告诉我们。
In case of issue let us know.
这篇关于如何在Wpf中的Datagrid中显示水平滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!