Welcome to the Xceed Community | Help
Community Search  

ComboBox don't update value to DataGrid

Sort Posts: Previous Next
  •  08-21-2008, 7:24 AM Post no. 14287

    ComboBox don't update value to DataGrid

    I have create DataGrid that contain ComboBox. I want user can select value to combobox. every thing work correctly except when i select value in combobox it don't update it value to datagrid (at first that column is null). I want to know how to solve this problem.

     Thanks!

  •  08-21-2008, 7:59 AM Post no. 14298 in reply to 14287

    Re: ComboBox don't update value to DataGrid

    Have you bound the SelectedValue property of the ComboBox using a CellEditorBinding?
    Technical Writer - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  08-21-2008, 8:16 AM Post no. 14299 in reply to 14298

    Re: ComboBox don't update value to DataGrid

    Jenny:
    Have you bound the SelectedValue property of the ComboBox using a CellEditorBinding?

    yes i do. i have found  thati have missing on value of SelectedValuePath (incorrect name)

    Thank for your fast respond. Smile

  •  08-22-2008, 10:48 AM Post no. 14392 in reply to 14298

    Re: ComboBox don't update value to DataGrid

    I'm new to Exceed and having a real pain of a time implementing a dead simple combobox, and this seems like the right thread. Upon editing the cell I see the combobox, but after selecting value (stop editting I guess) and leaving the row, the value returns to the originally binded value.  I'm hesitant to post, as I know I missing something simple, but I've been at this for a bit now and am my wit's end.

     <xcdg:Column FieldName="BookType" Title="Book Type"  Width="100" >
                                        <xcdg:Column.CellEditor>
                                            <xcdg:CellEditor>
                                                <xcdg:CellEditor.EditTemplate>
                                                    <DataTemplate>
                                                        <ComboBox SelectedValuePath="BookType" SelectedValue="{xcdg:CellEditorBinding}" ItemTemplate=" StaticResource bookTypeDataTemplate}">
                                                            <ComboBoxItem>Unbooked</ComboBoxItem>
                                                            <ComboBoxItem>Vanilla</ComboBoxItem>
                                                            <ComboBoxItem>NV</ComboBoxItem>
                                                            <ComboBoxItem>XBook</ComboBoxItem>
                                                            <ComboBoxItem>semi</ComboBoxItem>
                                                        </ComboBox>
                                                    </DataTemplate>
                                                </xcdg:CellEditor.EditTemplate>
                                            </xcdg:CellEditor>
                                        </xcdg:Column.CellEditor>
                                    </xcdg:Column>

     

  •  08-22-2008, 11:09 AM Post no. 14395 in reply to 14392

    Re: ComboBox don't update value to DataGrid

    The reason it is failing is that you are attempting to associate a ComboBoxItem/string with a BookType value. That said, change your combobox to use the BookType enumeration values rather than strings in ComboBoxItems. For example:

     <xcdg:Column FieldName="BookType" Title="Book Type"  Width="100" >
                                        <xcdg:Column.CellEditor>
                                            <xcdg:CellEditor>
                                                <xcdg:CellEditor.EditTemplate>
                                                    <DataTemplate>
                                                        <ComboBox SelectedValuePath="BookType" SelectedValue="{xcdg:CellEditorBinding}" ItemTemplate=" StaticResource bookTypeDataTemplate}">

                                                            <x:Static Member="BookType.Unbooked"/>
                                                            <x:Static Member="BookType.Vanilla"/>
                                                            <x:Static Member="BookType.NV"/>
                                                            <x:Static Member="BookType.XBook"/>
                                                            <x:Static Member="BookType.semi"/>

                                                           </ComboBox.Items>
                                                        </ComboBox>
                                                    </DataTemplate>
                                                </xcdg:CellEditor.EditTemplate>
                                            </xcdg:CellEditor>
                                        </xcdg:Column.CellEditor>

                                    </xcdg:Column> 

     


    Technical Writer - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  09-01-2008, 4:11 PM Post no. 14732 in reply to 14395

    Re: ComboBox don't update value to DataGrid

    Thanks for the reply Jenny.

    I'll keep playing with it, but the idea was that the BookType type was a string (and I was using the ComboBox to limit/filter the entry).  I know that seems a little wonky, but the business object/model was inherited, and I was really hoping to not have to change it.  Based on your example, and the other threads I've read, looks like I won't be able to do it this way.

    I was thinking that I could hook into the selectionChanged event, but I would either need to pass the Id of the row (another attribute of the model) as a command arguement,  or I would need to be able to discover the entire row as a parent control to the combobox (neither of which I've been able to do so far).

  •  10-29-2008, 7:38 AM Post no. 16481 in reply to 14395

    Re: ComboBox don't update value to DataGrid

    Hi jenny

     I'am using the Combobox with the combobox item. I want to bind it with an enumeration. i have seen that you used static items.

    Can you tell me the difference between Combo and Navigable combo.

    <xcdg:CellEditor x:Key="combotest_Enabled" >

    <xcdg:CellEditor.EditTemplate>

    <DataTemplate>

    <xcdg:NavigableComboBox SelectedIndex="2" SelectionChanged="combotest_SelectioChanged" IsEnabled="True">

    <ComboBoxItem>test1</ComboBoxItem>

    <ComboBoxItem>test2</ComboBoxItem>

    <ComboBoxItem>test3</ComboBoxItem>

    <ComboBoxItem>test4</ComboBoxItem>

    </xcdg:NavigableComboBox>

    </DataTemplate>

    </xcdg:CellEditor.EditTemplate>

    </xcdg:CellEditor>

     

    please tell me how to make it connected with the datasource. It is disconnected and is not getting update.How to bind this with an enum and

    how to get these templates as cells

    dataRow.Cells[index] as Xceed.Wpf.DataGrid.DataCell;

    and so that we can assign selected value to the cell.

    Thanks in advance

  •  10-30-2008, 11:48 AM Post no. 16515 in reply to 16481

    Re: ComboBox don't update value to DataGrid

    As stated in the documentation,  the NavigableComboBox represents a combo box control that supports navigation within its drop-down section.

    As for binding the ComboBox, we're not sure we understand your question correctly, but basically, you must do exactly as Jenny shows, except that you must set a source through the ItemsSource property instead of adding items.


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