C#C
C#3y ago
5 replies
DapperDeer

Dependency Properties and When to use ObservableCollections

Hello, I'm trying to figure out how best to architect my little Pokedex application that I'm making and would appreciate some guidance/assistance.

In my MainWindow code-behind, it's getting a service that pulls all the Pokemon information from an API that I'm calling and storing it in an ObservableCollection, which the PokemonDetails is binding to.

In the PokemonDetails code-behind, I have a Dependency Property but something about this binding is not working. I don't think I'm doing the Dependency Property correctly, and I'm not sure if using an ObservableCollection in my MainWindow.xaml.cs is necessary. My thought process was that the collection will be updated, notify the PropertyChanged event (which I don't actually subscribe it to anything, maybe that's the issue?), which would notify the PokemonDetails UserControl, update its dep property, and display the list correctly.

Code is in replies to this thread.
Was this page helpful?