Well, here is my XAML code:
<ComboBox Grid.Row="2"
Grid.Column="1"
Margin="10"
Width="250"
Height="30"
VerticalAlignment="Top"
HorizontalAlignment="Left"
ItemsSource="{Binding AllProducts}"
SelectedItem="{Binding SelectedProduct}"/>
And this is my C# code:
private ObservableCollection<Product> allProducts = new ObservableCollection<Product>();
public ObservableCollection<Product> AllProducts
{
get => allProducts;
set
{
db.Products.Select(x => x).AsObservableCollection();
RaisePropertyChangedEvent(nameof(AllProducts));
}
}
All I want to do is to select all products from my database and the simply add it to the ComboBox. But somehow it does not work. No error and no exception.