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
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.
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
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.
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
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.
I forgot to thank you :).
The latest build fixed it all, thanks!
Regards, Sandi
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
I also have the problem that the scrolling is very slow, when using the comboboxcolumn in the grid.
Thomas.
this way, actual scrolling does not happen till you release the mouse, much better performance!
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
Has there is been any updates since the last post?
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
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
Is there any updates to this issue coming soon?
Can you post more info about your grid version?
Regards,Vlad
the Telerik team
<
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.
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
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?
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
Thanks!
Jim
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 >>
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 >>
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?
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 >>
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
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 >>
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.
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 >>
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.
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 >>