I want my DataGrid have ComboBox with default value for example I have a column for Genre:
- Action
- Drama
- Comedy
I Want ComboBox Show those data and then select the item in database (for example in database Genre is Drama.
I use WPF Net 6 with EF Sqlite for manage Database.
in Database Class I set Genre as string.
DataGrid of other Column I use Something like this:
<DataGridTextColumn Header="ID" Binding="{Binding Path=ID,UpdateSourceTrigger=PropertyChanged}"/>in Code Behind:
DgTest.ItemsSource=db.Test.ToList();
This is how i fix my problem. same as Firo but in simple way.
My Model for Genre:
my Repository:
My View-Model
and then Bind AllGenreList to ComboBox.
this is how i fix my problem. hope solve some one else problem.