Welcome to the Xceed Community | Help
Community Search  
More Search Options

Dynamic ComboBox CellEditor Tip

Sort Posts: Previous Next
  •  07-01-2009, 1:44 PM Post no. 22188

    Dynamic ComboBox CellEditor Tip

    Hi everyone I was helping someone bind multiple property values to one column and learned some new things. Then I applied what I learned to ComboBoxes. and found a new way to Bind ComboBox.ItemsSource at runtime related to the current row.


                                <xcd:CellEditor>
                                    <xcd:CellEditor.EditTemplate>
                                        <DataTemplate>
                                            <ComboBox
                                                DataContext="{Binding RelativeSource={RelativeSource AncestorType=xcd:DataRow}, Path=DataContext}"
                                                ItemsSource="{Binding Employee.JobCodes}"
                                                SelectedItem="{xcd:CellEditorBinding}"
                                                IsEditable="True"
                                                DisplayMemberPath="Jc"/>
                                        </DataTemplate>
                                    </xcd:CellEditor.EditTemplate>
                                </xcd:CellEditor>

    The DataRow Context is your data Item(business object)

    ItemsSource="{Binding Employee.JobCodes}" //Employee is a property  on my business object and JobCodes is an IEnumerable on Employee

      DisplayMemberPath="Jc" Jc is a property on the JobCode object

    Just thought I would share as there are lots of ComboBox Posts

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.