Welcome to the Xceed Community Sign in | Join | Help
Community Search  

ComboBox in DataGrid column

  •  04-21-2008, 8:11 AM

    ComboBox in DataGrid column

    Hi,
    I'm having trouble displaying a combox as a cell content in the datagrid.
    I'm using a DataSet as the DataContext. I currently have two tables:
    1. The data for the grid (named ItemList with the columns Name and UnitId)
    2. The the data for the combobox (named Units with the columns Id and Description)
    The column UnitId in table ItemList references (one-to-many) the column Id in Units.

    The XAML looks like this:
    <xcdg:DataGridControl ItemsSource="{Binding Path=ItemList}" AutoCreateColumns="False">
    <xcdg:DataGridControl.Columns>
    <xcdg:Column Title="Name" FieldName="Name" />
    <xcdg:Column FieldName="UnitId" Title="Unit">
    <xcdg:Column.CellEditor>
    <xcdg:CellEditor>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>
    <ComboBox ItemsSource="{Binding Path=Units}"
    SelectedValuePath="Id"
    DisplayMemberPath="Description"
    SelectedValue="{xcdg:CellEditorBinding}" />
    </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
    </xcdg:CellEditor>
    </xcdg:Column.CellEditor>
    </xcdg:Column>
    </xcdg:DataGridControl.Columns>
    </xcdg:DataGridControl>

    The problem is that the combobox is empty when I try to edit the cells content.
View Complete Thread
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.