Datagrid Scroll bars

Dec 11, 2014 at 6:08 AM
I am probably doing something silly wrong here .. but i cannot get a scroll bar to appear in my list of items, my items go below the height of the screen , and dont want to implement paging .. as should never be more than
2 pages
Dec 11, 2014 at 6:49 AM
Can you post the XAML of your page?
Dec 11, 2014 at 7:51 AM
I've updated the sample app so that you can add more items to the data grid which shows the scroll viewer...

The page's XAML:

Download the sample code in the downloads section...
Dec 11, 2014 at 8:46 AM
Hi there , thanks for the quick response..

below is my xaml, il also have a look at your new updated code. Just on another note, im developing an app for a very strict environment, and will probably have to reduce this down to just the grid, as will not be allowed to have a toolkit with all the other controls etc. is there a way to do this thorugh nuget ?

        <StackPanel Orientation="Vertical">

            <TextBlock Text="Search Results" Style="{StaticResource SubheaderTextBlockStyle}" Margin="0,10,0,10"/>

                ItemsSource="{Binding CustomerSearchModel.SearchResults}"
                ScrollViewer.VerticalScrollMode="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"

                        <controls:DataGridTextColumn Width="200" 
                        Binding="{Binding FullName}" 
                        <controls:DataGridTextColumn Width="200" 
                        Header="ID Number" 
                        Binding="{Binding IDNumber}" 
                        Header="Last Address" 
                        Binding="{Binding LastAddressString}" 

                            <StackPanel Margin="10,10,10,5">
                                <TextBlock Text="Details: " FontWeight="ExtraBold" />
                                <StackPanel Orientation="Horizontal">
                                    <StackPanel Orientation="Vertical">
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="CellNumber: " FontWeight="SemiLight"></TextBlock>
                                            <TextBlock Text="{Binding CellNumber}" Margin="15,0,15,0"></TextBlock>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="Date Of Birth: " FontWeight="SemiLight"></TextBlock>
                                            <TextBlock Text="{Binding  DateOfBirthDisplayString}"  Margin="15,0,15,0"></TextBlock>



Dec 11, 2014 at 8:51 AM
Do not put the datagrid in a stackpanel... This way the grid stretches to its contents and the scrollviewer is never shown... Ill write more later
Dec 11, 2014 at 4:56 PM
Please checkout the sample app. There you can add more items to the DataGrid which shows the scroll bars without problems... When putting the DataGrid into a StackPanel it fully stretches and the scroll bars are never shown because the height is not limited by its parent child...

If you need only the data grid you can download the source code from the page and just copy the necessary classes into a new project, but it will take some time as the DataGrid uses lots of other classes internally...