I have this RadComboBox placed inside a RadGridViewDataColumn:
<tk:RadGridView
Name="grdPeople"
ItemsSource="{Binding People}"
SelectedItem="{Binding SelectedPerson, Mode=TwoWay}">
<tk:GridViewDataColumn
DataMemberBinding="{Binding PeopleDetails}"
UniqueName="PeopleDetails"
Header="People">
<tk:GridViewDataColumn.CellTemplate>
<TextBlock
Text="{Binding Title}"/>
</tk:GridViewDataColumn.CellTemplate>
<tk:GridViewDataColumn.CellEditTemplate>
<tk:RadComboBox
DisplayMemberPath="TitleValue"
SelectedItem="{Binding Path=People.Title, Mode=TwoWay}"
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type tk:RadGridView}}, Path=DataContext.Titles}"/>
</tk:GridViewDataColumn.CellEditTemplate>
</tk:GridViewDataColumn>
</tk:RadGridView>
I know that the problem comes with mixing of the RadGridView and the window data context objects, but not sure, why title doesn't get saved in the DB?
On the contrary, if I replace the RadComboBox with ordinary TextBox:
<TextBox
Width="50"
Text="{Binding Title}"
TextAlignment="Left"/>
Typing the value in a text box works just fine, saving the title in the DB.
I am guessing its, something with mixing the various components in the cell edit template of RadGridView?
Just change the Path of SelectedItem binding from 'People.Title' to 'Title'
<tk:RadComboBox
DisplayMemberPath="TitleValue"
SelectedItem="{Binding Path=Title, Mode=TwoWay}"
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type tk:RadGridView}}, Path=DataContext.Titles}"/>