Databound GridViewComboBoxColumn

36 posts, 1 answers
  1. Sandi Markon
    Sandi Markon avatar
    101 posts
    Member since:
    Jul 2012

    Posted 29 Apr 2009 Link to this post

    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 :-/
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 04 May 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Sandi Markon
    Sandi Markon avatar
    101 posts
    Member since:
    Jul 2012

    Posted 06 May 2009 Link to this post

    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
  5. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 11 May 2009 Link to this post

    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.
  6. Sandi Markon
    Sandi Markon avatar
    101 posts
    Member since:
    Jul 2012

    Posted 14 May 2009 Link to this post

    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
  7. Answer
    Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 18 May 2009 Link to this post

    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.
  8. Sandi Markon
    Sandi Markon avatar
    101 posts
    Member since:
    Jul 2012

    Posted 28 May 2009 Link to this post

    Hello.

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

    Regards, Sandi
  9. brandon
    brandon avatar
    16 posts
    Member since:
    Nov 2009

    Posted 04 Dec 2009 Link to this post


  10. Abdelrahman
    Abdelrahman avatar
    3 posts
    Member since:
    Jul 2010

    Posted 06 Jul 2010 Link to this post

    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
  11. Thomas
    Thomas avatar
    58 posts
    Member since:
    Jun 2009

    Posted 09 Jul 2010 Link to this post

    Hi,

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

    Thomas.
  12. Abdelrahman
    Abdelrahman avatar
    3 posts
    Member since:
    Jul 2010

    Posted 13 Jul 2010 Link to this post

    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!
  13. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 14 Jul 2010 Link to this post

    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
  14. Ujjwal Lahoti
    Ujjwal Lahoti avatar
    67 posts
    Member since:
    Jan 2010

    Posted 02 Aug 2010 Link to this post

    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?
  15. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 03 Aug 2010 Link to this post

    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
  16. Jason
    Jason avatar
    20 posts
    Member since:
    Jul 2010

    Posted 15 Sep 2010 Link to this post

    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?
  17. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 16 Sep 2010 Link to this post

    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
  18. Jason
    Jason avatar
    20 posts
    Member since:
    Jul 2010

    Posted 28 Sep 2010 Link to this post

    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.
  19. Duncan
    Duncan  avatar
    13 posts
    Member since:
    Mar 2011

    Posted 06 Jun 2011 Link to this post

    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?
  20. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 07 Jun 2011 Link to this post

    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
  21. Duncan
    Duncan  avatar
    13 posts
    Member since:
    Mar 2011

    Posted 07 Jun 2011 Link to this post

    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.
  22. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 13 Jun 2011 Link to this post

    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
  23. Duncan
    Duncan  avatar
    13 posts
    Member since:
    Mar 2011

    Posted 13 Jun 2011 Link to this post

    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?
  24. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 17 Jun 2011 Link to this post

    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
  25. Paul Grothe
    Paul Grothe avatar
    26 posts
    Member since:
    Apr 2010

    Posted 02 Aug 2011 Link to this post

    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
  26. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 08 Aug 2011 Link to this post

    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 >>

  27. Alan
    Alan avatar
    32 posts
    Member since:
    Jan 2011

    Posted 15 Aug 2011 Link to this post

    Will this service pack release allow GridViewComboBoxColumn's drop down arrow to be display with having to click on a the cell itself?
  28. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 17 Aug 2011 Link to this post

    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 >>

  29. Alan
    Alan avatar
    32 posts
    Member since:
    Jan 2011

    Posted 17 Aug 2011 Link to this post

    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?
  30. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 22 Aug 2011 Link to this post

    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 >>

  31. Alan
    Alan avatar
    32 posts
    Member since:
    Jan 2011

    Posted 25 Aug 2011 Link to this post

    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

Back to Top
UI for WPF is Visual Studio 2017 Ready