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

GridViewComboBoxColumn is blank after lost focus

2 Answers 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 27 Oct 2016, 06:57 AM

Dear Telerik,

I am having the same problem as in this post: http://www.telerik.com/forums/gridviewcomboboxcolumn-lost-value-when-lost-focus

however, I believe that I have set all values required:

 <telerik:RadGridView Name="PFGrid" AutoGenerateColumns="False" Height="228" ScrollMode="RealTime" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto"
                                     NewRowPosition="Top"
                                     AlternationCount="2"
                                     AutoExpandGroups="False" 
                                     CanUserDeleteRows="True" 
                                     CanUserInsertRows="True"
                                     ShowColumnFooters="False"
                                     ShowColumnHeaders="True"
                                     ShowColumnSortIndexes="False"
                                     ShowGroupFooters="False"
                                     ShowGroupPanel="False"
                                     RowEditEnded="PFGrid_RowEditEnded"
                                     EditTriggers="Default" 
                                     Loaded="PFGrid_Loaded"
                                     >
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewComboBoxColumn Header="Quote Section" UniqueName="MaterialType" Width="100" IsFilterable="False" 
                                                        IsGroupable="False" IsReorderable="False" IsSortable="False" 
                                                        DataMemberBinding="{Binding MATERIALTYPE_UID}"
                                                        DisplayMemberPath="MATERIALTYPE_NAME"
                                                        SelectedValueMemberPath="MATERIALTYPE_UID"
                                                        ShowDistinctFilters="False" TextWrapping="Wrap">
                        </telerik:GridViewComboBoxColumn>

 

materialtypes is an array of my business object and is set on UserControl Loaded using my API calls:

materialtypes = MainWindow.dataclient.GetMATERIAL_TYPE(new MATERIAL_TYPE(), " ORDER BY MATERIALTYPE_NAME ASC ");

PFGrid.ItemsSource is also set on UserControl loaded:
formulas = MainWindow.dataclient.GetPOST_FORMULA(f, " ORDER BY POST_FORMULA_MATERIAL_TYPEDetail.MATERIALTYPE_NAME ASC ");
PFGrid.ItemsSource = formulas;

GridViewComboBoxColumn ItemsSource property is set on Grid Loaded event:
((GridViewComboBoxColumn)this.PFGrid.Columns[0]).ItemsSource = materialtypes;

 

Any help would be appreciated.

thanks.

2 Answers, 1 is accepted

Sort by
0
Matthew
Top achievements
Rank 1
answered on 27 Oct 2016, 11:29 AM

My apologies,

I have found my error as described in this post: http://www.telerik.com/forums/gridviewcomboboxcolumn-not-displaying-selected-value

my error was binding the combobox to a property of the business object instead of binding the combobox to a property of the Grid's itemssource.

Thanks.

0
Stefan Nenchev
Telerik team
answered on 28 Oct 2016, 11:57 AM
Hi Matthew,

I am glad to see that you have managed to resolve your issue. Thank you for sharing the solution as it might help other customers in the same situation.

Regards,
Stefan Nenchev
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
Tags
GridView
Asked by
Matthew
Top achievements
Rank 1
Answers by
Matthew
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Share this question
or