0

I have 3 datagrid that in a stackpanel and grid that I need to add in a scroll viewer too. When I try to add the scroll viewer to grid or stack panel nothing happens. When I surround the entire stackpanel and grid with a scroll viewer it works but it put the scroll bar to the side of the page separated from the datagrids. What I need is the grid/stackpanel to scroll all three grids together (I don’t want each data grid to scroll; I need them to stay grouped together). Below is my current code. Thank!!

                <StackPanel Margin="10,162,0,50" HorizontalAlignment="Left" Width="365">                    
                <Grid>  

                <Rectangle Fill="{StaticResource BaseColor}" 

                           Stroke="Gray"  
                           RadiusX="10" 
                           RadiusY="10" 
                           Margin="0,0,0,0" />

                <StackPanel x:Name="IdentifyResultsStackPanel" 
                        Margin="15,10,15,10" 
                        Visibility="Collapsed">

                <TextBlock Text="ELEMENTARY SCHOOL ATTENDANCE AREA:" 
                           Foreground="White" 
                           FontSize="14" 
                           FontStyle="Italic" 
                           Margin="0,0,0,5" />

                    <slData:DataGrid x:Name="IdentifyDetailsDataGrid" 
                                 AutoGenerateColumns="False"
                                 LoadingRow="IdentifyDetailsDataGrid_LoadingRow"
                                 HeadersVisibility="None" >
                        <slData:DataGrid.Columns>
                            <slData:DataGridTextColumn Binding="{Binding Path=Key}" FontWeight="Bold"/>
                            <slData:DataGridTextColumn Binding="{Binding Path=Value}"/>
                        </slData:DataGrid.Columns>
                    </slData:DataGrid>

                    <TextBlock Text="MIDDLE SCHOOL ATTENDANCE AREA:" 
                           Foreground="White" 
                           FontSize="14" 
                           FontStyle="Italic" 
                           Margin="0,0,0,5" />
                    <slData:DataGrid x:Name="IdentifyDetailsDataGrid2" 
                                     AutoGenerateColumns="False"
                                     LoadingRow="IdentifyDetailsDataGrid_LoadingRow"
                                     HeadersVisibility="None" >
                        <slData:DataGrid.Columns>
                            <slData:DataGridTextColumn Binding="{Binding Path=Key}" FontWeight="Bold"/>
                            <slData:DataGridTextColumn Binding="{Binding Path=Value}"/>
                        </slData:DataGrid.Columns>
                    </slData:DataGrid>

                    <TextBlock Text="HIGH SCHOOL ATTENDANCE AREA:" 
                           Foreground="White" 
                           FontSize="14" 
                           FontStyle="Italic" 
                           Margin="0,0,0,5" />
                    <slData:DataGrid x:Name="IdentifyDetailsDataGrid3" 
                                 AutoGenerateColumns="False"
                                 LoadingRow="IdentifyDetailsDataGrid_LoadingRow"
                                 HeadersVisibility="None" >
                        <slData:DataGrid.Columns>
                            <slData:DataGridTextColumn Binding="{Binding Path=Key}" FontWeight="Bold"/>
                            <slData:DataGridTextColumn Binding="{Binding Path=Value}"/>
                        </slData:DataGrid.Columns>
                    </slData:DataGrid>

                </StackPanel> 
            </Grid>
        </StackPanel>
GoofyTO
  • 19
  • 1
  • 5

1 Answers1

0

The stackpanel was the issue. The following link helped me with the problem:

How to add a ScrollBar to a StackPanel in Silverlight?

Community
  • 1
  • 1
GoofyTO
  • 19
  • 1
  • 5