I have some view
public class MyItem : ReactiveUserControl<MyItemViewModel> {...
with some corresponding xaml and the below call sets up the viewmodel to view registration for me
Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly());
When I bind the ItemsSource property of a ListBox, the items are displayed with the registered view. However, when I define a UserControl that includes a ListBox
<UserControl x:Class="MyProject.Views.NavItem"
...
<StackPanel>
...
<ListBox ItemsSource="{Binding Path=ItemsSource}">
</ListBox>
</StackPanel>
</UserControl>
and bind to its ItemsSource, the items are displayed with .ToString().
How can I get my custom UserControl's ListBox items to display using the registered view?
CodePudding user response:
You need to use ReactiveUI binding to get automatic view resolution not Xaml binding.