You seem to be somewhat confused. You have one ListView
in your CategoryView UserControl
. Its ItemsSource
property can only be data bound to one collection, so clearly, when changing the collections in the main view model and the CategoryViewModel
, only one will affect the ListView
.
It seems from your code that the CategoryViewModel
is set as the DataContext
for the UserControl
, so the collection in the main view model will not be connected to the ListView
. If you want to data bind from the ListView
to the collection in the main view model instead, then you'll need to use a RelativeSource Binding
instead:
<ListView ItemsSource="{Binding SomeCollection, RelativeSource={RelativeSource
AncestorType={x:Type YourPrefix:YourParentType}}}" ... />
Even so, now the collection in your CategoryViewModel
will no longer be connected, so you'd better decide exactly what you want to do here.