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

GridViewComboBoxColumn - GetBindingExpression UpdateBindingSource

10 Answers 138 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 17 Aug 2011, 06:58 PM
I would like the GridViewComboBoxColumn to update its binding source immediately when the user makes a selection. 

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

Sort by
0
Maya
Telerik team
answered on 18 Aug 2011, 01:38 PM
Hi Aaron,

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

0
Aaron
Top achievements
Rank 1
answered on 18 Aug 2011, 10:03 PM
Maya, thanks for the reply.

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!
0
Maya
Telerik team
answered on 22 Aug 2011, 04:18 PM
Hello Aaron,

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

0
Aaron
Top achievements
Rank 1
answered on 22 Aug 2011, 04:22 PM
Unfortunately I cannot use the RadComboBox as there is a bug using it within the RadDataGrid.  I submitted a bug report and the details can be viewed here:

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?
0
Pavel Pavlov
Telerik team
answered on 25 Aug 2011, 03:29 PM
Hello Aaron,

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

0
Aaron
Top achievements
Rank 1
answered on 25 Aug 2011, 04:39 PM
Pavel, thanks very much for the update on this.  We'll look forward to the update.  Which version will the patch be applied to?  We just upgraded our SL control suite to the latest, so hopefully the patch will apply to the latest version as well?

Thanks again!
0
Pavel Pavlov
Telerik team
answered on 25 Aug 2011, 05:01 PM
Hi Aaron,

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

0
thomas
Top achievements
Rank 1
answered on 19 Sep 2011, 06:46 PM
Is the RadComboBox being fixed, inside the RadGridView being fixed? Nothing about RadComboBox is in the release notes for the internal build...When is this service pack coming out?
0
Pavel Pavlov
Telerik team
answered on 26 Sep 2011, 09:37 AM
Hi Thomas,

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

0
Aaron
Top achievements
Rank 1
answered on 26 Sep 2011, 07:22 PM
Is the RadComboBox being fixed, inside the RadGridView being fixed? Nothing about RadComboBox is in the release notes for the internal build...When is this service pack coming out?
Tags
GridView
Asked by
Aaron
Top achievements
Rank 1
Answers by
Maya
Telerik team
Aaron
Top achievements
Rank 1
Pavel Pavlov
Telerik team
thomas
Top achievements
Rank 1
Share this question
or