Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable scrolling inside datagrid in wpf c#

I have done VerticalScrollBarVisibility="Disabled" because i dont want the content inside datagrid to be viewed which crosses the assigned height. I am not able to see scroll bar after giving the above statement.but i still can scroll down and see the rows.Can someone tell me how do i disable scrolling all together? Thanks

like image 757
wpflearner Avatar asked Aug 08 '11 08:08

wpflearner


1 Answers

Allow DataGrid to show all it's content (so it needn't scroll bar):

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <DataGrid x:Name="DataGrid" />
</Grid>

You can than put the result in any place. It'll cut down it's size to the owner's dimensions

like image 72
Lu55 Avatar answered Oct 02 '22 14:10

Lu55