Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
Adding Combobox Columns Dynamically to XAMGrid
posted

Hello ,

I am trying to add the following column through the codebehind.

 

ComboBoxColumn comboBoxColumn = new ComboBoxColumn();
comboBoxColumn.ItemsSource = (IEnumerable) property.GetValue(applicationLookupProvider, null);
comboBoxColumn.HeaderText = savedLoanTemplateField.Name;
comboBoxColumn.Key = savedLoanTemplateField.Name;
comboBoxColumn.DisplayMemberPath = lookupAttribute.DisplayMemberPath;
comboBoxColumn.SelectedValuePath = lookupAttribute.SelectedValuePath;

loansGrid.Columns.Add(comboBoxColumn);

 

It properly adds the column but all the dropdown values are set to blank. It does not show the properly selectedValuePath in the dropdown. I am using reflection to add bind the ItemSource and when I set the breakpoint the IEnumerable list is getting set.

Please advise.

Pawan

Parents
No Data
Reply
  • 6759
    Offline posted

    Hi Pawan,

    I was not able to reproduce the issue you are referring to

    I have attached the sample solution I used while trying to reproduce the issue. 

    You could check if the values you provide to DisplayMemberPath and SelectedValuePath are correct. If they are not you should get some binding errors in the output window of VS.

    If this is not the case it will be good to provide the build numbers of the assemblies you use and modify the sample solution so the issue is easily reproducible.

     

    HTH,

    XamGrid_AddComboColumnFromCodeBehind.zip
Children