Currently, the binding source is not updated until the user makes a selection and tabs off of the GridViewComboBoxColumn.
I tried to create a behavior (Interactivity.Behavior) for the GridViewComboBoxColumn, but because it is not a FrameworkElement, I cannot invoke GetBindingExpression() on it.
I see that the GridViewComboBoxColumn uses a RadComboBox internally, but I cannot obtain access to it either.
How can I get a handle to a framework element from the GridViewComboBoxColumn so that I can manually update its bindings?
Or is there a better way to tell the GridViewComboBoxColumn to update its binding after a user makes a selction?
Thanks
10 Answers, 1 is accepted
You may subscribe to the SelectionChanged event of the RadComboBox and commit the edit on a selection. For example:
this.AddHandler(RadComboBox.SelectionChangedEvent, new Telerik.Windows.Controls.SelectionChangedEventHandler(OnSelectionChanged));
private void OnSelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
{
if (e.RemovedItems.Count > 0)
{
this.playersGrid.CommitEdit();
}
}
Kind regards,
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
There are a couple problems with your code sample:
1.) It forces me to wire up this event on every view in my project and then i have to write code in the code behind for each view.
2.) I don't want to commitEdit on the entire grid. This is not the behavior I want.
Surely there must be another way to invoke the binding on the wrapped comboBox?
Could you possibly escalate this to your dev team?
Thanks much!
The behavior for updating the property when editing the cells is by default for the grid. What you may do is to define a CellTemplate for a column and set a RadComboBox inside. Thus the property will be updated once you select a new value:
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding ClubID}"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
telerik:RadComboBox
SelectedValuePath
=
"ID"
SelectedValue
=
"{Binding ClubID, Mode=TwoWay}"
ItemsSource
=
"{Binding Clubs, Source={StaticResource MyViewModel}}"
DisplayMemberPath
=
"Name"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
</
telerik:GridViewDataColumn
>
Best wishes,
Maya
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 >>
http://www.telerik.com/account/support-tickets/view-ticket.aspx?threadid=451880
So it looks like I'm forced to wait for the patch with the bug fix then?
I will try pushing the fix for this with high priority as we really can't find a workaround so far. I hope we manage to provide a solution within a week or two .
I am leaving the thread open so I can keep you posted about the progress.
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 >>
Thanks again!
The target is the Q2 service pack release. Speaking of "about two weeks" I was refering our latest internal builds as well.
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 >>
As I am not sure if you are asking about the same issue discussed with Aaron Hanusa in a private support communication, can you please open a separate support ticket with a short description of the troubles you are having with RadComboBox inside RadGridView.
Regards,
Pavel Pavlov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>