Home Forums WPF controls Xceed DataGrid for WPF ComboBox CellEditor

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23273 |

    Hi,

    A property in my Modell Object on which I bound the XCEED grid is of the type Enum, so I would like that the cell can only display content which is a member of that type.
    I was trying to put a ComboBox in a Cell Editor and I get the right data when the Element is loadet but the ComboBox won’t write the selected value to the datasource. Any suggestions?

    Thanks
    Silas

    <xcdg:Column FieldName=”Degradation”
    Title=”Degradation” >
    <xcdg:Column.CellEditor>
    <xcdg:CellEditor>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>
    <ComboBox IsSynchronizedWithCurrentItem=”True” SelectedValue=”{Binding Path=Degradation, Mode=TwoWay}”>
    <ComboBoxItem Content=”Full” Width=”Auto” Height=”Auto”/>
    <ComboBoxItem Content=”Partial” Width=”Auto” Height=”Auto”/>
    <ComboBoxItem Content=”Low” Width=”Auto” Height=”Auto”/>
    </ComboBox>
    </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
    <xcdg:CellEditor.ActivationGestures>
    <xcdg:KeyActivationGesture Key=”Right”/>
    <xcdg:KeyActivationGesture Key=”Left”/>
    </xcdg:CellEditor.ActivationGestures>
    </xcdg:CellEditor>
    </xcdg:Column.CellEditor>
    </xcdg:Column>

    Imported from legacy forums. Posted by Ralf (had 2411 views)

    User (Old forums)
    Member
    Post count: 23064

    If the content of the comboboxitem is set to a string I dont think it will automatically convert to enum(or int)
    you should supply a convertor for your ComboBox SelectedValue to convert the string to a int

    Imported from legacy forums. Posted by MiddleTommy (had 234 views)

    User (Old forums)
    Member
    Post count: 23064

    I changed my base type to string and use the OnSelectionChanged from the combobox to change the Model Object. It works now. Thank you very much Tommy!

    Imported from legacy forums. Posted by Ralf (had 3412 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.