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

RadGridView and Docking problem

12 Answers 138 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aracna
Top achievements
Rank 1
Aracna asked on 21 Jun 2012, 07:36 AM
Hi,

We have been using 2010 Q2 all this while. We recently upgraded to 2012 Q1. After the upgrade we are running into multiple issues.

We are using Docking in our application. On one of the radpanes we have gridview. On this gridview the showgrouppanel is set to false.
Now when we undock one of the pinned dockpanes, the gridview displays grouppanel and the data is grouped.
This should not be the case.

12 Answers, 1 is accepted

Sort by
0
Aracna
Top achievements
Rank 1
answered on 25 Jun 2012, 07:46 AM
Any updates on this?
0
Vera
Telerik team
answered on 25 Jun 2012, 11:34 AM
Hello Aracna,

 
I tried to reproduce the reported issue but I was not able to. May I ask you to download our latest official version - Q2 2012 and to give it a try? In case you still experience the problem, please open a support ticket and send a simple runnable project demonstrating it. 


Thank you in advance. 

Greetings,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Vera
Telerik team
answered on 25 Jun 2012, 11:49 AM
Hi Aracna,

I have noticed that you are using our latest official version. Please excuse me for the misunderstanding. 
We will be glad to assist you once we reproduce the problem.

I am looking forward to hearing from you.

Regards,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Aracna
Top achievements
Rank 1
answered on 26 Jun 2012, 03:24 AM

using
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Data;
using Telerik.Windows.Controls;
using System.Globalization;
  
namespace GridAndDocking
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            ObjectListGrid.GroupDescriptors.CollectionChanging += new EventHandler<CollectionChangingEventArgs>(GroupDescriptors_CollectionChanging);
            LoadGridData();
            LoadTreeViewData(1);
        }
  
         bool _displayConfirmedOnly = true;
        bool _displayCleared = false;
        QueryableCollectionView _groupview;
  
  
          
  
        private void LoadGridData()
        {
            DateTime endTime = DateTime.Now.AddHours(1);
            //DateTime startdate = DateTime.Today.AddDays(-2);
            //string strStartdate = startdate.ToString(CultureInfo.GetCultureInfo("en-GB"));
            string strEndTime = endTime.ToString(CultureInfo.GetCultureInfo("en-GB"));
              
                //  FODListGrid.ItemsSource = iFerretService.FODServiceProxy.GetFODDetails(DateTime.Parse(strStartdate), DateTime.Parse(strEndTime), RunwayId);
            ObjectListGrid.ItemsSource =
                    serviceProxy.FODServiceProxy.GetDetails(
                        DateTime.Parse("02/01/2012 9:00:00 AM"), DateTime.Parse(strEndTime), 1);
                    if (_displayConfirmedOnly)
                    {
                        btnFalse.IsEnabled = false;
                        btnConfirm.IsEnabled = false;
                        btnClear.IsEnabled = false;
  
                        Telerik.Windows.Controls.GridViewColumn statusColumn = ObjectListGrid.Columns["Status_Cd"];
                        IColumnFilterDescriptor statusColumnFilter = statusColumn.ColumnFilterDescriptor;
                        statusColumnFilter.SuspendNotifications();
                        statusColumnFilter.FieldFilter.Filter1.Operator = FilterOperator.IsEqualTo;
                        statusColumnFilter.FieldFilter.Filter1.Value = StatusCode.Confirmed;
                        statusColumnFilter.ResumeNotifications();
                    }
                    if (!_displayCleared)
                    {
                        btnFalse.IsEnabled = false;
                        btnConfirm.IsEnabled = false;
                        btnClear.IsEnabled = false;
                        Telerik.Windows.Controls.GridViewColumn statusColumn = ObjectListGrid.Columns["Status_Cd"];
                        IColumnFilterDescriptor statusColumnFilter = statusColumn.ColumnFilterDescriptor;
                        statusColumnFilter.SuspendNotifications();
                        statusColumnFilter.FieldFilter.Filter1.Operator = FilterOperator.IsNotEqualTo;
                        statusColumnFilter.FieldFilter.Filter1.Value = StatusCode.Cleared;
                        statusColumnFilter.ResumeNotifications();
                    }
        }
  
  
        private void LoadTreeViewData(int id)
        {
            try
            {
  
                if (ObjectListGrid.Items.Count > 0)
                {
  
                    _groupview = new QueryableCollectionView(ObjectListGrid.Items);
                    if (ObjectListGrid.GroupDescriptors.Count > 0)
                        ObjectListGrid.GroupDescriptors.Clear();
                    var descriptor = new GroupDescriptor { Member = "Status_Cd" };
                    descriptor.AggregateFunctions.Add(new CountFunction());
                    System.Threading.Thread.Sleep(2000);
                    ObjectListGrid.GroupDescriptors.Add(descriptor);
  
                }
                else
                {
                    foreach (RadTreeViewItem treeitem in FodCategoryTree.Items)
                    {
                        if (treeitem.Header.ToString().IndexOf('(') > 0)
                        {
                            string newheader = treeitem.Header.ToString().Substring(0, treeitem.Header.ToString().IndexOf('('));
                            treeitem.Header = newheader;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                  
            }
        }
  
  
        void GroupDescriptors_CollectionChanging(object sender, CollectionChangingEventArgs e)
        {
            try
            {
                if (ObjectListGrid.GroupDescriptors.Count > 0)
                    ObjectListGrid.GroupDescriptors.Clear();
                _groupview.GroupDescriptors.Add(e.Item as GroupDescriptor);
                foreach (QueryableCollectionViewGroup catgroup in _groupview.Groups)
                {
                    switch (catgroup.Key.ToString())
                    {
                        case "cat1":
                            cat1.Header = "Category 1(" + catgroup.ItemCount.ToString(CultureInfo.InvariantCulture) + ")";
                            break;
  
                        case "cat2":
                            cat2.Header = "Category 2(" + catgroup.ItemCount.ToString(CultureInfo.InvariantCulture) + ")";
                            break;
  
                        case "cat3":
                            cat3.Header = "Category 3(" + catgroup.ItemCount.ToString(CultureInfo.InvariantCulture) + ")";
                            break;
  
                        case "cat4":
                            cat4.Header = "Category 4(" + catgroup.ItemCount.ToString(CultureInfo.InvariantCulture) + ")";
                            break;
                    }
  
                }
                catAll.Header = "All(" + ObjectListGrid.Items.Count.ToString(CultureInfo.InvariantCulture) + ")";
                //e.Cancel = true;
                 
            }
            catch (Exception ex)
            {
                 
                MessageBox.Show("ObjectListGrouping :" + ex.Message, "System Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
  
            }
        }
    }
}
ObjectListGrid.GroupDescriptors.CollectionChanging += new EventHandler<CollectionChangingEventArgs>(GroupDescriptors_CollectionChanging);<br>            LoadGridData();<br>            LoadTreeViewData(1);<br>        }<br><br><br>         bool _displayConfirmedOnly = true;<br>        bool _displayCleared = false;<br>        QueryableCollectionView _groupview;<br><br><br><br><br>        <br><br><br>        private void LoadGridData()<br>        {<br>            DateTime endTime = DateTime.Now.AddHours(1);<br>            //DateTime startdate = DateTime.Today.AddDays(-2);<br>            //string strStartdate = startdate.ToString(CultureInfo.GetCultureInfo("en-GB"));<br>            string strEndTime = endTime.ToString(CultureInfo.GetCultureInfo("en-GB"));<br>            <br>                //  FODListGrid.ItemsSource = iFerretService.FODServiceProxy.GetFODDetails(DateTime.Parse(strStartdate), DateTime.Parse(strEndTime), RunwayId);<br>            ObjectListGrid.ItemsSource =<br>                    serviceProxy.FODServiceProxy.GetDetails(<br>                        DateTime.Parse("02/01/2012 9:00:00 AM"), DateTime.Parse(strEndTime), 1);<br>                    if (_displayConfirmedOnly)<br>                    {<br>                        btnFalse.IsEnabled = false;<br>                        btnConfirm.IsEnabled = false;<br>                        btnClear.IsEnabled = false;<br><br><br>                        Telerik.Windows.Controls.GridViewColumn statusColumn = ObjectListGrid.Columns["Status_Cd"];<br>                        IColumnFilterDescriptor statusColumnFilter = statusColumn.ColumnFilterDescriptor;<br>                        statusColumnFilter.SuspendNotifications();<br>                        statusColumnFilter.FieldFilter.Filter1.Operator = FilterOperator.IsEqualTo;<br>                        statusColumnFilter.FieldFilter.Filter1.Value = StatusCode.Confirmed;<br>                        statusColumnFilter.ResumeNotifications();<br>                    }<br>                    if (!_displayCleared)<br>                    {<br>                        btnFalse.IsEnabled = false;<br>                        btnConfirm.IsEnabled = false;<br>                        btnClear.IsEnabled = false;<br>                        Telerik.Windows.Controls.GridViewColumn statusColumn = ObjectListGrid.Columns["Status_Cd"];<br>                        IColumnFilterDescriptor statusColumnFilter = statusColumn.ColumnFilterDescriptor;<br>                        statusColumnFilter.SuspendNotifications();<br>                        statusColumnFilter.FieldFilter.Filter1.Operator = FilterOperator.IsNotEqualTo;<br>                        statusColumnFilter.FieldFilter.Filter1.Value = StatusCode.Cleared;<br>                        statusColumnFilter.ResumeNotifications();<br>                    }<br>        }<br>
 
 
 
 
        private void LoadTreeViewData(int runwayId)
        {
            try
            {
 
 
                if (ObjectListGrid.Items.Count > 0 && runwayId == 1)
                {
 
 
                    _groupview = new QueryableCollectionView(ObjectListGrid.Items);
                    if (ObjectListGrid.GroupDescriptors.Count > 0)
                        ObjectListGrid.GroupDescriptors.Clear();
                    var descriptor = new GroupDescriptor { Member = "Status_Cd" };
                    descriptor.AggregateFunctions.Add(new CountFunction());
                    System.Threading.Thread.Sleep(2000);
                    ObjectListGrid.GroupDescriptors.Add(descriptor);
 
 
                }
                else
                {
                    foreach (RadTreeViewItem treeitem in FodCategoryTree.Items)
                    {
                        if (treeitem.Header.ToString().IndexOf('(') > 0)
                        {
                            string newheader = treeitem.Header.ToString().Substring(0, treeitem.Header.ToString().IndexOf('('));
                            treeitem.Header = newheader;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                 
            }
        }
 
 
 
 
        void GroupDescriptors_CollectionChanging(object sender, CollectionChangingEventArgs e)
        {
            try
            {
                if (ObjectListGrid.GroupDescriptors.Count > 0)
                    ObjectListGrid.GroupDescriptors.Clear();
                _groupview.GroupDescriptors.Add(e.Item as GroupDescriptor);
                foreach (QueryableCollectionViewGroup catgroup in _groupview.Groups)
                {
                    switch (catgroup.Key.ToString())
                    {
                        case "cat1":
                            cat1.Header = "Category 1(" + catgroup.ItemCount.ToString(CultureInfo.InvariantCulture) + ")";
                            break;
 
 
                        case "cat2":
                            cat2.Header = "Category 2(" + catgroup.ItemCount.ToString(CultureInfo.InvariantCulture) + ")";
                            break;
 
 
                        case "cat3":
                            cat3.Header = "Category 3(" + catgroup.ItemCount.ToString(CultureInfo.InvariantCulture) + ")";
                            break;
 
 
                        case "cat4":
                            cat4.Header = "Category 4(" + catgroup.ItemCount.ToString(CultureInfo.InvariantCulture) + ")";
                            break;
                    }
 
 
                }
                catAll.Header = "All(" + ObjectListGrid.Items.Count.ToString(CultureInfo.InvariantCulture) + ")";
                //e.Cancel = true;
                
            }
            catch (Exception ex)
            {
                
                MessageBox.Show("ObjectListGrouping :" + ex.Message, "System Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
 
 
            }
        }
    }
}


<Window x:Class="GridAndDocking.MainWindow"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"      
        xmlns:Dock="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
        xmlns:Navigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
        xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"      
        xmlns:grid="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
         Title="MainWindow" Height="350" Width="525">
    <Grid>
 
        <Dock:RadDocking  x:Name="MainDockingPanel" HasDocumentHost="False">
            <Dock:RadSplitContainer Dock:DockingPanel.InitialSize="150,150" MaxWidth="250"
                    x:Name="LeftContainer" InitialPosition="DockedLeft"
                    Dock:ProportionalStackPanel.RelativeSize="15,100">
                <Dock:RadPaneGroup x:Name="LeftGroup">
                    <Dock:RadPane x:Name="CategoriesPane" Header="Categories"
                                  MaxWidth="250">
                        <Grid>
                            <Navigation:RadTreeView x:Name="FodCategoryTree">
                                <Navigation:RadTreeViewItem x:Name="catAll" Header="All(0)" Tag="All"/>
                                <Navigation:RadTreeViewItem x:Name="cat1" Header="Category1(0)" Tag="cat1"/>                                                               
                                <Navigation:RadTreeViewItem x:Name="cat2" Header="Category2(0)" Tag="cat2"/>
                                <Navigation:RadTreeViewItem x:Name="cat3" Header="Category3(0)" Tag="cat3"/>
                                <Navigation:RadTreeViewItem x:Name="cat4" Header="Category4(0)" Tag="cat4"/>
 
                            </Navigation:RadTreeView>
                        </Grid>
                    </Dock:RadPane>
                </Dock:RadPaneGroup>
 
            </Dock:RadSplitContainer>
 
 
            <Dock:RadSplitContainer InitialPosition="DockedRight"  Dock:DockingPanel.InitialSize="445,300"
                                    x:Name="MapListContainer" Orientation="Vertical">
                <Dock:RadPaneGroup x:Name="TopGroup" Dock:ProportionalStackPanel.RelativeSize="200,100">
 
                    
                    <Dock:RadPane x:Name="MapPane" Header="Digital Map" >
                    </Dock:RadPane>
                </Dock:RadPaneGroup>
 
                <Dock:RadPaneGroup x:Name="BottomGroup">
                    <Dock:RadPane x:Name="DataListGroup" Header="Fod List"
                                  Dock:RadDocking.SerializationTag="FodList"
                                  Dock:DockingPanel.Dock="Bottom" >
                        <Grid x:Name="ListContainer">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="150"/>
                            </Grid.ColumnDefinitions>
 
                        
                            <Border CornerRadius="10" BorderBrush="Gray" BorderThickness="1"
                                    Margin="2,5" Padding="5" Width="Auto" Grid.Column="0">
                                <telerikGrid:RadGridView x:Name="ObjectListGrid" AutoGenerateColumns="False"
                                        Width="Auto" Height="Auto" ColumnWidth="125" IsReadOnly="true"
                                        CanUserDeleteRows="False" CanUserInsertRows="False"
                                        AreRowDetailsFrozen="True" RowIndicatorVisibility="Collapsed"
                                        CanUserSelect="True" SelectionMode="Single" IsFilteringAllowed="False"
                                        ShowGroupPanel="False" RowDetailsVisibilityMode="VisibleWhenSelected"
                                        grid:GridViewVirtualizingPanel.IsVirtualizing="False" ShowGroupFooters="False">
                                    <telerikGrid:RadGridView.Columns>
                                        <telerikGrid:GridViewSelectColumn/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=UID}" Header="ID"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=CameraID}" Header="CameraID"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=DetectTime}" Header="Detect Time"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=Status_Cd}" Header="Status"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=Subsector}" Header=" Subsector"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=Focus}" Header="Focus"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=Zoom}" Header="Zoom"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=PanAngle}" Header="Pan"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=TiltAngle}" Header="Tilt"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=ConfirmFODNum}" Header="Confirmed FOD"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=SuspectFODNum}" Header="Suspected FOD"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=Coordinate}" DataFormatString="" Header="Coordinates"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=Size}" Header="Size"/>
                                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Path=Remark}" Header="Remarks"/>
                                    </telerikGrid:RadGridView.Columns>
                                </telerikGrid:RadGridView>
                            </Border>
                            <Border CornerRadius="10" Margin="0,5,1,5" Padding="4" Grid.Column="1"
                                    BorderBrush="Gray" BorderThickness="1" Width="125">
                                <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                                    <telerik:RadButton x:Name="btnClearSelection" HorizontalContentAlignment="Center"
                                            VerticalContentAlignment="Center" Margin="1,2" Padding="0,2"
                                            Content="Clear Selection" />
                                    <telerik:RadButton x:Name="btnConfirm" HorizontalContentAlignment="Center"
                                            VerticalContentAlignment="Center"  Margin="1,2" Padding="0,2"
                                            Content="Confirm Object" />
                                    <telerik:RadButton x:Name="btnClear" HorizontalContentAlignment="Center"
                                            VerticalContentAlignment="Center"  Margin="1,2" Padding="0,2"
                                                       Content="Clear Object"  />
                                    <telerik:RadButton x:Name="btnFalse" HorizontalContentAlignment="Center" Padding="0,2"
                                            VerticalContentAlignment="Center"  Margin="1,2"
                                            Content="False Object" />
                                </StackPanel>
                            </Border>
                        </Grid>
 
                    </Dock:RadPane>
                </Dock:RadPaneGroup>
 
            </Dock:RadSplitContainer>
 
 
        </Dock:RadDocking>
 
    </Grid>
</Window>


What I noticed is after I add the Group descriptors from code behind, and dock the tree view into the grid view pane, the gridview will showgrouppanel.
0
Aracna
Top achievements
Rank 1
answered on 27 Jun 2012, 06:46 AM
Any luck with reproducing the issue?
0
Vera
Telerik team
answered on 27 Jun 2012, 12:29 PM
Hi Aracna,

 
Thank you for the project sent. I tested it with Q2 2012 and I was not able to reproduce the problem. Please take a look at this video. As you can see, the group panel remains hidden when the button is pressed, i.e. a group descriptor is added to the GridView. Is there something I am missing?

Greetings,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Aracna
Top achievements
Rank 1
answered on 28 Jun 2012, 05:08 AM
Why is the groupheaader being shown? Also after I set the itemsource property of the datagrid, the itemcount is 0.
There are so many changes since the previous version, and it is not even documented. It is so frustrating. In Q2 2010 the Group is not null, now in 2012 the group is expected to be null? If in future you make another release what is the guarantee the code will not break anymore.
0
Vera
Telerik team
answered on 28 Jun 2012, 11:13 AM
Hi Aracna,

 
The version you used (Q2 2010) is quite old and there are a lot of changes, fixes and improvements that we have made since then. Here you can find a detailed release history.   
Would you please clarify what you mean by group header? The group rows appear since I have not canceled the CollectionChanging event and group descriptor is added to the GridView. As for the items count, I tested the project once again and I did get the right number of items - 16. 

Regards,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Aracna
Top achievements
Rank 1
answered on 28 Jun 2012, 02:24 PM
By groupheader, I mean the group row. We do not wish to display the grouprow,

Have you tried with the source code provided here? In the LoadGridData () at this sentence
ObjectListGrid.ItemsSource =
                    serviceProxy.FODServiceProxy.GetDetails(
                        DateTime.Parse("02/01/2012 9:00:00 AM"), DateTime.Parse(strEndTime), 1);
                    
After the itemsource is assigned the item count is 0, and hence in the LoadTreeViewData (), the descriptor is never added.

0
Aracna
Top achievements
Rank 1
answered on 29 Jun 2012, 01:35 AM
I think it is best if you could give me a sample  working example with changes to my codes from 2010 to 2012.
The code in 2010 is based on the Group in Queryable collection. So the group.count is displayed, now since the group is null obviously there will be no count. How to get the Count from GroupDescriptor?

This is my scenario: I have a datagrid, on which showgrouppanel is set to false. And there is a treeview, whose items are groups based on datagrid. Say Country column of datagrid is grouped and the count of items in each group is displayed in the treeview. At any given time, the datagrid should not show any sort of grouping.

You mentioned that, I could iterate through GroupDescriptor in the Collection_changed event, and in order to not display the group row, should cancel the collectionchanging event. Well, if the collectionchanging event is cancelled, how will the collectionchanged event be raised?
My working code with 2010 is above, please give me a working code for 2012.
0
Aracna
Top achievements
Rank 1
answered on 03 Jul 2012, 09:19 AM
Any feedback?
0
Pavel Pavlov
Telerik team
answered on 03 Jul 2012, 02:00 PM
Hello,

RadGridView is not capable of providing  aggregate results for grouped data , when it is actually not grouped.
Such info you may get executing a LINQ query of yours. over your data independently from RadGridView.

Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Aracna
Top achievements
Rank 1
Answers by
Aracna
Top achievements
Rank 1
Vera
Telerik team
Pavel Pavlov
Telerik team
Share this question
or