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

GridViewComboBoxColumn apply the selected value on select

1 Answer 79 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Svetoslav
Top achievements
Rank 1
Svetoslav asked on 17 Jul 2018, 01:34 PM

Is is possible with GridViewComboBoxColumn to apply the selected value on combobox select.

Now I have the following combobox column and the selected value is set to the viewmodel when the cell lose focus:

<telerik:GridViewComboBoxColumn Header="header text" ItemsSourceBinding="{Binding Actions}" DataMemberBinding="{Binding Action, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                             DisplayMemberPath="NameDisp" EditTriggers="CellClick"  />     

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 19 Jul 2018, 10:10 AM
Hello Svetoslav,

Such behavior can be achieved by hooking up to the SelectionChanged event of the RadComboBox that GridViewComboBoxColumn uses for its editing operation. This is discussed in details in the Handle SelectionChanged for GridViewComboBoxColumn topic. In the event handler you can call the CommitEdit method of RadGridView as shown below.
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.RemovedItems.Count > 0)
            {
                this.pilotsGrid.CommitEdit();
            }
        }

I hope this helps, Svetoslav.

Regards,
Stefan
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Svetoslav
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or