Scrolling RadGridView in a RadPane

7 posts, 1 answers
  1. Craig Dean
    Craig Dean avatar
    16 posts
    Member since:
    Jan 2010

    Posted 22 Jan 2010 Link to this post

    I have been trying to use a RadGridView in a docked RadPane, but for the life of me the scroll bars never appear.  In my scenario I have a roolbar then a GridView inside a grid, but I can't get it to work even if the GridView is directly in the pane, in a grid on it's own or in a stackpanel.

    I need the gridview to fill the current pane, so I use VerticalAlignment="Strecth" HorizontalAlignment="Stretch".

    Can someone please give me an example of how to get the GridView's scroll bars to appear correctly?  I know I could add a scrollviewer, but I want the headers to stay in place.

    Thanks.
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 26 Jan 2010 Link to this post

    Hi,

    If the grid is measured with infinity height you will not get the vertical scrollbar - this can happen if the grid is inside StackPanel or ScrollViewer.

    Sincerely yours,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Craig Dean
    Craig Dean avatar
    16 posts
    Member since:
    Jan 2010

    Posted 27 Jan 2010 Link to this post

    Hi Vlad,

    Thank you for your reply.  I suspected as much.  As I mentioned my problem is that the Grid doesn't show scroll bars when placed inside a RadPane.  I need the RadGridView inside a Grid inside a RadPane, and for it to fill the remainder of the RadPane.  I'm guessing from what you say that the content of the RadPane has infinite height?

    Is there any way to place a RadGridView inside a RadPane such that it resizes with the RadPane (e.g. when you resize the docked pane?) and fills the RadPane (or at least a grid within the RadPane) correctly and shows a scroll bar.  I cannot get it to work.

    Thanks.
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 28 Jan 2010 Link to this post

    Hello,

    Generally you do not have to do anything special - grid placed in RadPane will be scrollable by default:

    <UserControl x:Class="SilverlightApplication1.MainPage"
        xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
        xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
       mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
        <Grid x:Name="LayoutRoot">
            <telerikDocking:RadDocking>
                <telerikDocking:RadSplitContainer>
                    <telerikDocking:RadPaneGroup>
                        <telerikDocking:RadPane>
                            <telerikGrid:RadGridView Loaded="RadGridView_Loaded"/>
                        </telerikDocking:RadPane>
                    </telerikDocking:RadPaneGroup>
                </telerikDocking:RadSplitContainer>
            </telerikDocking:RadDocking>
        </Grid>
    </UserControl>


    You can check the attached project for reference.

    Best wishes,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Craig Dean
    Craig Dean avatar
    16 posts
    Member since:
    Jan 2010

    Posted 29 Jan 2010 Link to this post

    Thanks for the help, it turned out that the GridView stops showing the scrollbar when you add the MinHeight attribute, removing the minimum height caused it to work as expected.

    Is this normal behaviour for silverlight/WPF layouts?  If so, sorry for being so thick.
  7. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 01 Feb 2010 Link to this post

    Hi,

    I've tried to set MinHeight for the grid however the only problem I've noticed is related to the grid group panel - this will be fixed in our Q1 2010 release themes. Here is an example how to avoid this in the current version:

    XAML
    <UserControl x:Class="SilverlightApplication1.MainPage"
        xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
        xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
       mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
        <Grid x:Name="LayoutRoot">
            <telerikDocking:RadDocking>
                <telerikDocking:RadSplitContainer>
                    <telerikDocking:RadPaneGroup>
                        <telerikDocking:RadPane>
                            <telerikGrid:RadGridView MinHeight="500" Loaded="RadGridView_Loaded" />
                        </telerikDocking:RadPane>
                    </telerikDocking:RadPaneGroup>
                </telerikDocking:RadSplitContainer>
            </telerikDocking:RadDocking>
        </Grid>
    </UserControl>


    C#
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using System.IO;
    using System.Text;
    using Telerik.Windows.Controls;
    using Telerik.Windows.Data;
    using Telerik.Windows.Controls.GridView;
     
    namespace SilverlightApplication1
    {
        public partial class MainPage : UserControl
        {
            public MainPage()
            {
                InitializeComponent();
     
            }
     
            private void RadGridView_Loaded(object sender, RoutedEventArgs e)
            {
                ((RadGridView)sender).ItemsSource = from i in Enumerable.Range(0, 100)
                              select new MyObject() { ID = i, Name = String.Format("Name & {0}", i) };
     
                ((RadGridView)sender).ChildrenOfType<GridViewGroupPanel>().ToList().ForEach(gp => gp.ClearValue(GridViewGroupPanel.MinHeightProperty));
     
            }
        }
     
        public class MyObject
        {
            public int ID { get; set; }
            public string Name { get; set; }
        }
    }


    Sincerely yours,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Tae Lee
    Tae Lee avatar
    2 posts
    Member since:
    Jan 2010

    Posted 14 Sep 2011 Link to this post

    Could you also share if this type of workaround needs to be placed for RadDocumentPane in RadPaneGroup?  Thank you.
Back to Top
DevCraft banner