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

Databound GridViewComboBoxColumn

35 Answers 968 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sandi Markon
Top achievements
Rank 1
Sandi Markon asked on 29 Apr 2009, 07:00 AM
Hello!

I am having some problems with the GridViewComboBoxColumn that is databound. In the grid I am displaying postal codes. And each postal code belongs to a country. The country column is a GridViewComboboxCOlumn (Item source is a list of countries from the DB - Linq2SQL). Now I have 2 problems.
The fist is that the column Country is empty until I start scrolling (am I missing something?).

The second is that the scrolling is very slow. If I don't use the combobox the grid is fast again.Is there any way to make it faster?

I would also like to filter this column, but it only offers me ContryID's.  But if you use Contry.Name as DataMemberBinding, the Grid
updates all the Countries with the same name..


XAML:
<Window x:Class="WPF_LinQ.Forms.Glavno" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Glavno" Height="800" Width="600" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:System="clr-namespace:System;assembly=mscorlib" 
        > 
    <Grid> 
        <telerik:RadGridView Margin="5" Name="radGridView1" AutoGenerateColumns="False" CanUserReorderColumns="False" ColumnsWidthMode="Fill"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn HeaderText="Code" UniqueName="ID" /> 
                <telerik:GridViewDataColumn HeaderText="City" UniqueName="Name" /> 
                <telerik:GridViewComboBoxColumn  
                    ItemsSource="{Binding}"  
                    DataMemberBinding="{Binding Path=CountryID}"   
                    DisplayMemberPath="Name"  
                    SelectedValueMemberPath="ID"  
                    HeaderText="Country"  
                    UniqueName="CountryID" />             
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
    </Grid> 
</Window> 
 

CS:
 public partial class Glavno : Window 
    { 
        private DB.TMSDataContext m_DC; 
        public Glavno() 
        { 
            InitializeComponent(); 
            Init();  
        } 
      
 
        public void Init() 
        { 
            m_DC = new DB.TMSDataContext(); 
            radGridView1.Columns[2].DataContext = m_DC.Countries; 
            radGridView1.ItemsSource = m_DC.PostalCodes.OrderBy(e=>e.Name); 
            //radGridView1.Columns[3].DataContext = m_DC.PostalCodes.OrderBy(p => p.Name).ToArray(); 
            //radGridView1.Columns[2].DataContext = GetCountries(); 
                            
        } 
    } 


Thanks!

p.s. Yes I have looked at the demos example and it didn't help :-/

35 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 04 May 2009, 12:27 PM
Hi Sandi ,

It seems that passing the ItemsSource for the ComboBox column as a DataContext is causing troubles in your case.

Please try the following :

1. Remove the :
ItemsSource="{Binding}"  from the GridViewComboBoxcolumn

2. Replace the 

 radGridView1.Columns[2].DataContext = m_DC.Countries; 

with

((GridViewComboBoxColumn)this.RadGridView1.Columns[2]).ItemsSource = m_DC.Countries;



The idea is to directly set the items source thus avoiding the overhead and the troubles coming from the binding.

Regards,
Pavel Pavlov
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
Sandi Markon
Top achievements
Rank 1
answered on 06 May 2009, 09:48 AM
Hello Pavel!
 Thanks for your help. The first problem seems to be solved now, but my other problems are still there:
  • slow scrolling - when I drag the scrollbar there is a delay (1-2sec)
  • filtering and sorting (it does it by the foreign key and not by the name we display) - is there a workaround to solve it?

I've uploaded the project with the db to http://www.strokahosting.net/mhc/WPF-LinQ.7z


Regards,
Sandi
0
Pavel Pavlov
Telerik team
answered on 11 May 2009, 12:01 PM
Hello Sandi ,

Thank you for providing a sample project. I have made a few tests. I found the origin of both problems. We have already started refactoring of the internal logic of the GridViewCombobox column. Fixes targeting both of the problems will be included in our very next official release.  If meanwhile the issues are critical and block the development of your project , I may arrange a custom build for you as soon as we fix the problems (within two weeks) . Thanks for collaborationg on this one . We always appreciate a constructive feedback . I have updated your Telerik points.

Kind regards,
Pavel Pavlov
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
Sandi Markon
Top achievements
Rank 1
answered on 14 May 2009, 06:08 AM
Hello.

I am glad that the sample was useful and we would realy appreciate the custom build if it is possible because this is a feature our client would like to have implemented.

Best regards, Sandi
0
Accepted
Pavel Pavlov
Telerik team
answered on 18 May 2009, 07:46 AM
Hello Sandi ,
Just an update - the fixes for the ComboBox column will be available for download by the end of this week. There will be either an internal build or a Service Pack 2 available in your client.net account.

Regards,
Pavel Pavlov
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
Sandi Markon
Top achievements
Rank 1
answered on 28 May 2009, 12:33 PM
Hello.

I forgot to thank you :).
The latest build fixed it all, thanks!

Regards, Sandi
0
brandon
Top achievements
Rank 1
answered on 04 Dec 2009, 08:18 PM

0
Abdelrahman
Top achievements
Rank 1
answered on 06 Jul 2010, 06:13 PM
Hello,

I'm using Telerik version 2010.1.603.1040 and I am still facing the same problems that mentioned by Sandi, please advise.

1- Sorting and filtering on ID not value
2- Scrolling is very slow

Thanks,
Rahmy
0
Thomas
Top achievements
Rank 1
answered on 09 Jul 2010, 03:06 PM
Hi,

I also have the problem that the scrolling is very slow, when using the comboboxcolumn in the grid.

Thomas.
0
Abdelrahman
Top achievements
Rank 1
answered on 14 Jul 2010, 01:27 AM
A workaround this is to set the grid.ScrollMode = ScrollUpdateMode.Deferred;

this way, actual scrolling does not happen till you release the mouse, much better performance!
0
Pavel Pavlov
Telerik team
answered on 14 Jul 2010, 12:23 PM
Hi ,

Indeed we have identified such problem and we are already working on a fix . It will appear in one of our very next internal builds. Please excuse us for the inconvenience caused. Meanwhile the Deferred scrolling mode is a good workaround to use.

Kind regards,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ujjwal Lahoti
Top achievements
Rank 1
answered on 02 Aug 2010, 04:44 PM
I am also having similar issues. Scrolling is really slow, resulting in unacceptable user experience.

Has there is been any updates since the last post?
0
Milan
Telerik team
answered on 03 Aug 2010, 01:40 PM
Hello Ujjwal Lahoti,

We are still working on those improvements. Hopefully we will be able to introduce them for the Internal Build next Friday.

Thank you for your patience. 


Greetings,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jason
Top achievements
Rank 1
answered on 15 Sep 2010, 11:07 PM
Any updates on the performance changes? Have they been pushed out to a beta build yet?  Once I get the purchasing people to finally get our orders in for our licenses.. could I get the same build that fixed the problem earlier?
0
Milan
Telerik team
answered on 16 Sep 2010, 06:58 AM
Hi Jason,

If you referring to the improvements that we have made to our GridViewComboBox column, they will be included in our upcoming service pack which should be released in a bout a week. Also, most probably those fixes will be included in this week's Internal Build as well.

If you would like to have a look at the improvement beforehand we could send you a custom (unofficial) build that contains those fixes.

Greetings,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jason
Top achievements
Rank 1
answered on 28 Sep 2010, 06:35 PM
That would be terrific. I just updated to the SP2 build from 9/24 and am still seeing the same problems.  I posted a new thread detailing my situation as well.
0
Duncan
Top achievements
Rank 1
answered on 06 Jun 2011, 10:14 PM
We are also experiencing the incredibly slow scrolling issue when using a GridViewComboBoxColumn.  Our grid at the moment has about 1000 rows and 3 combo box columns.  Defered scrolling helps but is not what we want.  If we comment out the 3 columns then the grid scrolls smoothly.  

Is there any updates to this issue coming soon?
0
Vlad
Telerik team
answered on 07 Jun 2011, 07:04 AM
Hi,

 Can you post more info about your grid version? 

Regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Duncan
Top achievements
Rank 1
answered on 07 Jun 2011, 04:16 PM
We are using the GridView version 2011.1.419.40.  The grid is created as follows:

<telerik:RadGridView ShowGroupPanel="False"
                             ShowInsertRow="False"
                             ShowColumnFooters="True"
                             IsFilteringAllowed="False"
                             AutoGenerateColumns="False"
                             EnableColumnVirtualization="True"
                             EnableRowVirtualization="True"
                             ItemsSource="{Binding Path=Orders}"
                             >

We then have about 10 or so columns, 3 of which are Combo Box columns created as follows:

<telerik:GridViewComboBoxColumn Header="Source Location"
    ItemsSource="{Binding Locations}"
    UniqueName="SourceLocation"
    SelectedValueMemberPath="LocID"
    DisplayMemberPath="LocDesc"
    DataMemberBinding="{Binding Path=FromLocID}"
    >
 
    <telerik:GridViewComboBoxColumn.AggregateFunctions>
        <gridStats:ColumnNullCountAggregate SourceField="FromLocID"
            Caption="Unknown Sources: " />
    </telerik:GridViewComboBoxColumn.AggregateFunctions>
 
</telerik:GridViewComboBoxColumn>

There is nothing special there, we have tried turning off the aggregate functions for the footers but that has no effect.  Commenting out these 3 columns makes the grid behave properly.  Putting the columns back in makes the scrolling unusable.
0
Pavel Pavlov
Telerik team
answered on 13 Jun 2011, 09:36 AM
Hello Duncan ,

Recently we have found a performance issue in case you have combo columns with large amount of data bound to the combo  ( hundreds and thousands) .  We are already working on optimization.

In case this  covers your case ( I am not sure how many items do you have bound to the combo boxes),
a fix will be available in one of the very next internal releases , and in the beta version as well ( in less than 2 weeks) .

Meanwhile I have a workaround for the case with many items - a custom column inheriting the combo column. In case your case involves many items in the combo  let me know and I will send you some code for the faster custom combo column.

Regards,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Duncan
Top achievements
Rank 1
answered on 13 Jun 2011, 09:52 PM
We have about 1000 items in the combo box so this is probably the case.

Can you send me the code for the workaraound as it will speed up the development process around here until we get an official fix?
0
Pavel Pavlov
Telerik team
answered on 17 Jun 2011, 01:34 PM
Hello Duncan ,

I am attaching a small sample. It contains two instances of RadGridView. One with the standard combo column and one with a light version.  The light version should perform significantly better.

Hope this approach is applicable to your scenario.

Best wishes,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Paul Grothe
Top achievements
Rank 1
answered on 02 Aug 2011, 03:22 PM
I am also experiencing this issue with v.2011.2.712.35. It seems that disabling column virtualization fixes it as a temporary workaround. Telerik, any word on a fix for this issue yet?

Thanks!
Jim
0
Pavel Pavlov
Telerik team
answered on 08 Aug 2011, 08:56 AM
Hello Paul Grothe,

We have a fix for the service pack coming in a few weeks. Meanwhile we are fighting some side effects which occurred while applying it. Our goal is to ship it in the very next  service pack  and avoid introducing breaking changes in the API or the behaviour.

Meanwhile the only workaround I may suggest is the one mentioned in my previous post here.
Sincerely,
Pavel Pavlov
the Telerik team

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

0
Alan
Top achievements
Rank 2
answered on 15 Aug 2011, 04:36 PM
Will this service pack release allow GridViewComboBoxColumn's drop down arrow to be display with having to click on a the cell itself?
0
Pavel Pavlov
Telerik team
answered on 17 Aug 2011, 01:47 PM
Hi Alan,

If you need the combo to open automatically once you enter edit mode ( no additional click to open the drop down) ,
you need just to add the following editor style setting  to the combo column.
<telerik:GridViewComboBoxColumn.EditorStyle>
                        <Style TargetType="telerik:RadComboBox">
                            <Setter Property="IsDropDownOpen" Value="True" />
                        </Style>
                    </telerik:GridViewComboBoxColumn.EditorStyle>

All the best,
Pavel Pavlov
the Telerik team

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

0
Alan
Top achievements
Rank 2
answered on 17 Aug 2011, 03:28 PM
I tried your suggestion but it did not work in my setting. I may have not given all the needed details.

The GridViewComboBoxColumn is one of many per a given row in a WPF RadGridView which also includes regular TextBlock based cells mixed along with the GridViewComboBoxColumns.

The user is used to seeing (in an older Powerbuilder app) is use to seeing as the eye scans along the row which are drop down boxes by the drop down arrow when the grid is first presented to them.

Is there a way to do this behavior on a WPF RadGridView via the GridViewComboBoxColumn?
0
Pavel Pavlov
Telerik team
answered on 22 Aug 2011, 03:22 PM
Hi Alan,

Thanks for the clarifications .Yes, there is a way.  The cell has two modes - display and edit mode. When in display mode - it has a "flat"control and when in edit, it shows a combo.  We need to replace the "flat" control  with a combo.
You can do this by placing a RadCombBox in a DataTemplate. Then assign this data template to the CellTemplate property of the GridViewComboBoxColumn.

If you find any problems while implementing this approach, please let me know.

Regards,
Pavel Pavlov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Alan
Top achievements
Rank 2
answered on 25 Aug 2011, 08:04 PM
Pavel,

If possible, I would like your help in invoking the CellTemplate property within the data template in order to not get a "flat" combobox control rather place the object into edit if I understand your comments correctly.

Here is my code that works but leaves the control in a "flat" mode:
<telerikGrid:GridViewComboBoxColumn DataMemberBinding="{Binding RowStatus}"
                                                    ItemsSource="{Binding Path=RowStatuses, Source={StaticResource viewModel}}" />

I would be thankful for any suggestions.

Thank you,
Alan

0
Pavel Pavlov
Telerik team
answered on 31 Aug 2011, 04:04 PM
Hello Alan,
Here is an extract from a sample using this approach .

In the code bellow , you will need to replace the names of the properties with the ones of your business object. (e.g instead of CountriesList - your RowStatuses , instead of CountryID - your RowStatus etc.).
<telerik:RadGridView x:Name="RadGridView1"  AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Width="100" >
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <ComboBox DisplayMemberPath="Name"  SelectedValuePath="ID" SelectedValue="{Binding CountryID, Mode=TwoWay}" ItemsSource="{Binding Countries, Source={StaticResource CountriesList}}" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>


Regards,
Pavel Pavlov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Paul Grothe
Top achievements
Rank 1
answered on 21 Sep 2011, 04:29 PM
Pavel,

I just installed Q2 SP1 and the performance issue still has not been addressed. I have a combobox with ~2000 items in it and the only way to get acceptable scrolling and rendering performance is to use a regular GridViewDataColumn with a custom CellEditTemplate containing a combobox with virtualization. However, this causes issues with the FilteringControl since it uses the DataMemberBinding; the DataMemberBinding MUST be bound to the value of the combobox instead of the displaymember to enable copy/paste and other grid functions to work but this means that the FilteringControl filters on a different field than what is displayed to the user in the combobox. I've voted for a fix here (Silverlight would have the same fix as WPF):
http://www.telerik.com/support/pits.aspx#/public/silverlight/3897

As a workaround, you can use a converter to get the same display value shown in the combobox for the top half of the FilteringControl.

While the FilteringControl doesn't work perfectly, you can still get exceptional performance from a standard GridViewDataColumn with a custom CellEditTemplate.
0
Pavel Pavlov
Telerik team
answered on 26 Sep 2011, 03:08 PM
Hello Paul ,

Can you please check, do you use CellTemplate or CellEditTemplate for your workaround.

I am asking this because the CellEditTemplate is used only in Edit mode. In other words - only one cell can be in edit mode at a time. So changing this template only  should actually have no significant performance impact.

Greetings,
Pavel Pavlov
the Telerik team

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

0
Paul Grothe
Top achievements
Rank 1
answered on 27 Sep 2011, 08:20 PM
Yes, I replaced the CellTemplate as well, just a TextBlock binding to the displaymemberpath of the combobox in the celledittemplate.
0
Duncan
Top achievements
Rank 1
answered on 17 Apr 2012, 05:57 PM
We've been waiting for the scrolling performance to improve when using combo boxes with 1000+ items to improve for quite a while now but still have not seen any improvements.  The OptimizedComboColumn works OK, but I wouldn't even say that its performance is optimal.  It also doesn't work with nested objects.  

Is this still an item that's being looked at?  We are using the latest 2012.1.0326 controls.  We have a grid with 300 rows and 12 columns, 2 of which are large combo columns, 1 small combo column.
0
Pavel Pavlov
Telerik team
answered on 18 Apr 2012, 03:28 PM
Hi Duncan,

Our attempts to integrate the the code from the optimized combo column given previously as a sample in this thread resulted in many breaking changes as a side effects. We could not afford  to introduce such modifications which would break the existing code base of hundreds of our users. For the Time being the custom column I have given as sample is as close as we can get.

For scenarios where we have to perform lookup logic among hundreds and thousands items I would strongly recommend using the data layer rather than the UI to perform such task . In other words - performing the lookup at the server ( or the data layer)  and providing the result display value to the client would be the logical step to solve such problems.

I am afraid we can not squeeze much  more form the UI  in the context of performance.

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
Sandi Markon
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Sandi Markon
Top achievements
Rank 1
brandon
Top achievements
Rank 1
Abdelrahman
Top achievements
Rank 1
Thomas
Top achievements
Rank 1
Ujjwal Lahoti
Top achievements
Rank 1
Milan
Telerik team
Jason
Top achievements
Rank 1
Duncan
Top achievements
Rank 1
Vlad
Telerik team
Paul Grothe
Top achievements
Rank 1
Alan
Top achievements
Rank 2
Share this question
or