ComboBoxEditorSettings obsolete in Q3

5 posts, 0 answers
  1. Gerry
    Gerry avatar
    17 posts
    Member since:
    Mar 2009

    Posted 20 Nov 2009 Link to this post

    This old code (below) still works, but I get compile warnings for the obsolete items. How would I change this code to the new way of doing things?

    At this point I'm wondering if we will even be able to do what we did up to now. We changed the column EditorSettings based on the type of data that was to be entered in the cell where the user was currently entering data. Since we have different types of data in each row of a column (dates, combo values, strings, currency etc.) we just pogrammatically adjusted the editor settings based on the data that needed currently to be edited. So in the cells of a column, depending on the row, the user might be entering a date, or he had to pick a value out of a combo box.
     
    But now since you have a GridViewComboBoxColumn class now, this may not be possible anymore, which would severly impact us.

    This is the code I would like to modify.

                                    ComboBoxEditorSettings comboBoxEditorSettings = new ComboBoxEditorSettings();
                                    comboBoxEditorSettings.DisplayMemberPath = "txtCmbString";
                                    comboBoxEditorSettings.SelectedValuePath = "txtCmbString";
                                    comboBoxEditorSettings.ItemsSource = _cmbAuswahl.ComboboxRecordsColl.Where(c => c.txtKey == txtKey);
                                    ((GridViewDataColumn)this.UIRadGridFormular.Columns["UIValue"]).EditorSettings = comboBoxEditorSettings;

    Thanks for any insights. Gerry.
  2. Patrick Holloway
    Patrick Holloway avatar
    13 posts
    Member since:
    Sep 2009

    Posted 23 Nov 2009 Link to this post

    I am interested in an answer to this question, too.

  3. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 24 Nov 2009 Link to this post

    Hi,

    Generally you can inherit combobox column (or any other column), override CreateCellEditElement and return desired control. You can check this post for more info.

    Regards,
    Vlad
    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.
  4. Gerry
    Gerry avatar
    17 posts
    Member since:
    Mar 2009

    Posted 01 Dec 2009 Link to this post

        GridViewComboBoxColumn comboCol = new GridViewComboBoxColumn();  
        comboCol.DisplayMemberPath = "txtCmbString";  
        comboCol.SelectedValueMemberPath = "txtCmbString";  
        string pathy = string.Format("QuerFeld_{0:D2}_Wert", columnIndex + 1);  
        Binding comboBinding = new Binding();  
        comboBinding.Mode = BindingMode.TwoWay;  
        comboBinding.Path = new PropertyPath(pathy);  
        comboBinding.ValidatesOnExceptions = true;  
        comboBinding.NotifyOnValidationError = true;  
        comboBinding.UpdateSourceTrigger = UpdateSourceTrigger.Explicit;  
        comboCol.DataMemberBinding = comboBinding;  
        string key = rec.msfValidateTxtKey;  
        List<RecMacTxtCmb> items = new List<RecMacTxtCmb>();  
        items = _cmbBoxRec.ComboboxRecordsColl.Where(c => c.txtKey == key.ToString()).ToList<RecMacTxtCmb>();  
        comboCol.ItemsSource = items;  
        UIRadGridFormular.Columns[columnIndex] = comboCol;  
     

     

    Hi Vlad

    I changed the code using the old ComboBoxEditorSettings to the new GridViewComboBoxColumn. It looks like the code block above.

    I use this same code to change multiple columns of the grid. How many columns I have to change depends on the data.

    If I change only 1 column in the grid it works ok. But if I change more than one, I get an System.ExecutionEngineException - Data: System.Collections.EmptyReadOnlyDictionaryInternal. As long as I'm not touching more than 1 column, it does not matter which one it is, it works.

    My XAML looks like this:

                    <controls:RadGridView x:Name="UIRadGridFormular" MultipleSelect="False" ColumnsWidthMode="Auto" AutoGenerateColumns="False" 
                                  CanUserFreezeColumns="True" CanUserReorderColumns="False" CanUserResizeColumns="True" 
                                  ShowGroupPanel="False" IsFilteringAllowed="False" RowIndicatorVisibility="Collapsed" 
                                  ShowColumnHeaders="True" Background="White" 
                                  DataLoaded="UIRadGridFormular_DataLoaded"  RowLoaded="UIRadGridFormular_RowLoaded" 
                                  CellEditEnded="UIRadGridFormular_CellEditEnded" SelectionChanged="UIRadGridFormular_SelectionChanged"   
                                  CanUserInsertRows="False" CellValidating="UIRadGridFormular_CellValidating" 
                                  FrozenColumnCount="1" 
                                  ActionOnLostFocus="None" ValidationMode="Cell" IsReadOnly="False" > 
                        <!--HorizontalAlignment="Left" ActionOnLostFocus="CommitEdit" CanUserSortColumns="True" >--> 
                        <controls:RadGridView.Columns> 
                            <controls:GridViewDataColumn UniqueName="Spalte_1" DataMemberBinding="{Binding QuerFeld_01_Wert, Mode=TwoWay}" /> 
                            <controls:GridViewDataColumn UniqueName="Spalte_2" DataMemberBinding="{Binding QuerFeld_02_Wert, Mode=TwoWay}" /> 
                            <controls:GridViewDataColumn UniqueName="Spalte_3" DataMemberBinding="{Binding QuerFeld_03_Wert, Mode=TwoWay}" /> 
                            <controls:GridViewDataColumn UniqueName="Spalte_4" DataMemberBinding="{Binding QuerFeld_04_Wert, Mode=TwoWay}" /> 
                            <controls:GridViewDataColumn UniqueName="Spalte_5" DataMemberBinding="{Binding QuerFeld_05_Wert, Mode=TwoWay}" /> 
                            <controls:GridViewDataColumn UniqueName="Spalte_6" DataMemberBinding="{Binding QuerFeld_06_Wert, Mode=TwoWay}" /> 
                            <controls:GridViewDataColumn UniqueName="Spalte_7" DataMemberBinding="{Binding QuerFeld_07_Wert, Mode=TwoWay}" /> 
                            <controls:GridViewDataColumn UniqueName="Spalte_8" DataMemberBinding="{Binding QuerFeld_08_Wert, Mode=TwoWay}" /> 
                            <controls:GridViewDataColumn UniqueName="Spalte_9" DataMemberBinding="{Binding QuerFeld_09_Wert, Mode=TwoWay}" /> 
                        </controls:RadGridView.Columns> 
     

  5. Gerry
    Gerry avatar
    17 posts
    Member since:
    Mar 2009

    Posted 02 Dec 2009 Link to this post

    Hi Vlad

    I found the problem. I shot myself in the foot with this code:

        UIRadGridFormular.Columns[inty] = comboCol;  
     

    I changed it to:

        UIRadGridFormular.Columns.RemoveAt(inty);  
        UIRadGridFormular.Columns.Insert(inty, comboCol);  
     

    Now I no longer get the System.ExecutionEngineException. Thought I let you know.
Back to Top