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
290
How do I bind ComboBoxItemsProvider to the results of a method call?
posted

I have a ComboBoxItemsProvider that I am using for my editor style and I need to set its ItemsSource property to a List<Customer> which is generated in code behind when the page loads. There is no Name property so I can't expose it through XAML to my code behind and if I use a DynamicResource the combox is empty and the control doesn't support the ObjectDataProvider.

So the question is, how can I fill a combobox in the grid with a generic list that is generated when a code behind method is called?

Thanks!!

Parents
  • 9836
    Verified Answer
    posted

    Hello,

    You  can set the ItemsSource as DynamicResource like that :

    void Window1_Loaded(object sender, RoutedEventArgs e)

    {

                    xamDataGrid2.Resources.Add("pr", list);

    }

    <igDP:UnboundField Label="Last Name" >

            <igDP:Field.Settings>

                 <igDP:FieldSettings >

                           <igDP:FieldSettings.EditorStyle>

                                    <Style TargetType="{x:Type igEditors:XamComboEditor}">

                                        <Setter Property="ItemsSource" Value="{DynamicResource pr}" />

                                        <Setter Property="DisplayMemberPath" Value="LastName" />

                                    </Style>

                           </igDP:FieldSettings.EditorStyle>

               </igDP:FieldSettings>

          </igDP:Field.Settings>

    </igDP:UnboundField>

    Hope this helps

    Vlad

Reply Children