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

[Solved] Columns not Moveable or Groupable when RadGridView in RadWindow

4 Answers 208 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Randall Nelson
Top achievements
Rank 1
Randall Nelson asked on 16 Mar 2009, 08:51 PM
I have found that when a RadGridView is placed in a RadWindow, the user cannot move columns or do column grouping.  Below is code to reproduce.  I have a canvas where I have placed a grid - as well as a similar grid inside a RadWindow.  When you run this code you can move and group by columns when using the grid on the canvas, but not the one in the RadWindow.  Is there a workaround for this?

<UserControl xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"  xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"  x:Class="GridInsideWindowBug.Page" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
    Width="600" Height="400">  
    <Canvas x:Name="LayoutRoot" Background="AliceBlue">  
        <Button Content="Show Window" Width="90" Height="25" Click="Button_Click"/>  
        <telerikGridView:RadGridView x:Name="gdRegular" Canvas.Top="30" Width="300" Height="200" AutoGenerateColumns="True"/>  
        <telerikNavigation:RadWindow x:Name="rwGrid" Width="300" Height="200">  
            <telerikGridView:RadGridView x:Name="gdWindow" Width="300" Height="200" AutoGenerateColumns="True"/>  
        </telerikNavigation:RadWindow> 
    </Canvas> 
</UserControl> 

namespace GridInsideWindowBug  
{  
    public partial class Page : UserControl  
    {  
        public Page()  
        {  
            InitializeComponent();  
            this.Loaded += new RoutedEventHandler(Page_Loaded);  
        }  
 
        private void Page_Loaded(object sender, RoutedEventArgs e)  
        {  
            gdRegular.ItemsSource = GetPeople.GetData();  
            gdWindow.ItemsSource = GetPeople.GetData();  
        }  
 
        private void Button_Click(object sender, RoutedEventArgs e)  
        {  
            rwGrid.Show();  
        }  
    }  
Person Class:
    public class Person  
    {  
        public int PersonID { get; set; }  
        public string FirstName { get; set; }  
        public string LastName { get; set; }  
          
        public Person(int PersonID, string FirstName, string LastName)  
        {  
            this.PersonID = PersonID;  
            this.FirstName = FirstName;  
            this.LastName = LastName;  
        }  
    }  
 
    public static class GetPeople  
    {  
        public static List<Person> GetData()  
        {  
            List<Person> result = new List<Person>();  
            result.Add(new Person(1, "Thorgron", "Smifocon"));  
            result.Add(new Person(2, "Speevo", "Gleeb"));  
            return result;  
        }  
    }  
 

4 Answers, 1 is accepted

Sort by
0
Roger
Top achievements
Rank 1
answered on 17 Mar 2009, 12:05 AM
There is also a problem if with filters if the Rad window Width="Auto" and RadGridView ColumnWidthMode="Auto".

Changing the filter may change the width of the grid, which will also change the width of the window. But the drop down filter window doesn't redraw to reflect the change. If you move the mouse around, the checkboxes, buttons and scroll bar will redraw in the correct location. The screen can get very messy at this point.

0
Nedyalko Nikolov
Telerik team
answered on 19 Mar 2009, 06:12 PM
Hello Roger,

I cannot reproduce the issue you are talking about. Could you provide me with more detailed information and instructions how to simulate the problem?

Hello Randall,

You've hit a bug in GridView control, so I'll update your Telerik points. We will do our best to fix "DragAndDrop" issue with GridView and RadWindow for the next release or SP.

All the best,
Nedyalko Nikolov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roger
Top achievements
Rank 1
answered on 20 Mar 2009, 01:52 AM
Nedyalko,

Here is some code that shows the problem:
GridInWindow.xaml:
<rad:RadWindow  
    x:Class="Sandbox.GridInWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:rad="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    xmlns:grid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
    xmlns:gridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"      
    HorizontalAlignment="Center" 
    Width="Auto" MaxHeight="480"
    <Grid> 
        <Grid.ColumnDefinitions> 
            <ColumnDefinition Width="Auto"/> 
        </Grid.ColumnDefinitions> 
 
        <grid:RadGridView x:Name="dgDemo" 
            ColumnsWidthMode="Auto" 
            ShowGroupPanel="False" 
            > 
        </grid:RadGridView> 
    </Grid> 
</rad:RadWindow> 
 
GridInWindow.cs:

using System.Collections.Generic; 
using System.Linq; 
using Telerik.Windows.Controls; 
 
namespace Sandbox 
    public class Data 
    { 
        public string Col1 {get; set;} 
        public int Col2 {get; set;} 
    } 
 
    public partial class GridInWindow : RadWindow 
    { 
        public GridInWindow() 
        { 
            InitializeComponent(); 
            var list = new List<Data>(); 
            Enumerable.Range(1, 100).ToList().ForEach(x => list.Add(new Data {Col1=new string('a',x),Col2=x%4 })); 
            dgDemo.ItemsSource = list
        } 
    } 
 

In page.xaml I just new up the control and call ShowDialog()

If you scroll through the grid first, then everything works fine. The grid will expand for the larger Col1 data, and the Rad window will expand to fit the grid, and you can filter Col2 without any issues.

But if you try to filter Col2 before you scroll, things go wrong. If you check one of the filters, the grid and window will expand as before, but the filter box doesn't move to compensate. If you click another checkbox, or click one of the buttons you should see the problem. Or just move the mouse around.

Of course, the real app has a bit more to it. The outer <grid> has a number of rows and columns defined.

I admit that having the dialog resize as you scroll is a questionable UI design. I may be better off fixing the width of the data grid and using a texblock with wrap for the bigger columns.

Thanks,
Roger
0
Nedyalko Nikolov
Telerik team
answered on 23 Mar 2009, 02:21 PM
Hi Roger,

I've managed to reproduce the issue with filtering. It seems that this is a bug in our control. I'll update your Telerik points accordingly.

As a workaround you can try to initialize RadWindow and call ShowDialog() method when host page is already loaded.

Thank you again for the feedback.

Greetings,
Nedyalko Nikolov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Randall Nelson
Top achievements
Rank 1
Answers by
Roger
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or