This is a migrated thread and some comments may be shown as answers.

Scrolling RadGridView in a RadPane

6 Answers 229 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Craig Dean
Top achievements
Rank 1
Craig Dean asked on 22 Jan 2010, 10:55 AM
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.

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 26 Jan 2010, 01:25 PM
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.
0
Craig Dean
Top achievements
Rank 1
answered on 27 Jan 2010, 05:01 PM
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.
0
Vlad
Telerik team
answered on 28 Jan 2010, 01:15 PM
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.
0
Craig Dean
Top achievements
Rank 1
answered on 29 Jan 2010, 07:40 PM
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.
0
Accepted
Vlad
Telerik team
answered on 01 Feb 2010, 07:59 AM
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.
0
Tae Lee
Top achievements
Rank 1
answered on 14 Sep 2011, 03:31 PM
Could you also share if this type of workaround needs to be placed for RadDocumentPane in RadPaneGroup?  Thank you.
Tags
GridView
Asked by
Craig Dean
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Craig Dean
Top achievements
Rank 1
Tae Lee
Top achievements
Rank 1
Share this question
or