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
270
XamComboEditor with drop down grid
posted

Hi. In the winforms version of your combobox there is a nice feature to be able to bind a dataset to the combobox to show a grid in the drop down. Is this available in the XamComboEditor. If not any ideas how to set this up?

Parents
  • 69686
    Suggested Answer
    posted

    Hello,

    Basically, the XamComboEditor does not support this, but you could retemplate the ComboBoxDataItem's template and put a XamDataGrid inside, so that you can bind to a Collection,DataTable,etc.

    <igEditors:XamComboEditor Name="xamComboEditor1">

                        <igEditors:XamComboEditor.Resources>

                            <DataTemplate DataType="{x:Type igEditors:ComboBoxDataItem}" >

                                <Grid>

                                    <igDP:XamDataGrid x:Name="TextBlock" DataSource="{Binding Path=Value}" />

                                </Grid>

                            </DataTemplate>

                        </igEditors:XamComboEditor.Resources>

                    </igEditors:XamComboEditor>

    Then create ComboBoxItemsProvider and add a ComboBoxDataItem, which Value property you can set to a DataTable,Collection,etc. Add the ComboBoxDataItem in the ComboBoxItemsProvider and set the ItemsProvider property of the XamComboEditor.

    string[] values = new string[] { "value1", "value2", "value3" };
    ComboBoxDataItem cb = new ComboBoxDataItem();
    cb.Value = values;
    ComboBoxItemsProvider c = new ComboBoxItemsProvider();
    c.Items.Add(cb); 
    xamComboEditor1.ItemsProvider = c; 

    Hope this helps.

Reply Children