相关文章推荐
How do you handle the selection change of a GridViewComboBox? What event should I use? I Don't see a selectionchange.
When the value changes I want to populate other columns in the grid with portions of the data. Any idea how I can do that?
thanks in advance The attached example demonstrates a way to handle selection changes  combo box.
Let me know if you find a trouble adapting this to your project.
Sincerely yours,
Pavel Pavlov
the Telerik team Instantly find answers to your questions on the new Telerik Support Portal .
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Hi Paul Dyksterhouse,
Thanks for mentioning that. Actually the ComboBox does not exist until the cell enters edit mode. It is created on the fly ( in order to keep memory low and performance high) .
So when the Cell enters edit mode , the combo is created, and the selected value is being set to the value of the owning cell . This of course raises the selection changed event .
Although this is expected behavior , if this causes certain  complications  - we may think of a workaround for the certain scenario.
Regards,
Pavel Pavlov
the Telerik team Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
If anyone else is interested in the 'workaround' mentioned, take a look at the e.RemovedItems logic in the following thread.
http://www.telerik.com/community/forums/wpf/gridview/combobox-selection-event-is-getting-fired-on-row-delete-row-add-into-datagrid.aspx
private void OnSelectionChanged( object sender, SelectionChangedEventArgs e)
RadComboBox combo = (RadComboBox)sender;
if (combo.Name == "Something" )
Best regards,
I think (I have not tested this) you might actually have to do something like:
string name = comboBox.Name;
if (name.Equals( "SomeName" ){ }
before you can do the comparison.  I would have to test that to be sure but for some reason I thought you had to actually get the name before you did the compare else it would never work out....not sure why I feel like I tried this before...

You can set the UniqueName property of your ComboboxColumn:

< telerik:GridViewComboBoxColumn DataMemberBinding = "{Binding CountryId}"
UniqueName = "Country"
SelectedValueMemberPath = "Id"
DisplayMemberPath = "Name" />
then you can check CurrnetColumn's name along with the RemoveItems.Count:
this.AddHandler(RadComboBox.SelectionChangedEvent, new System.Windows.Controls.SelectionChangedEventHandler(OnSelectionChanged)); 
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
            if (e.RemovedItems.Count > 0 && (e.Source as RadGridView).CurrentColumn.UniqueName == "Country")
                //your code here
I hope this helps.
Regards,
Telerik TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
 
推荐文章