В ViewModel
входит
public List<string> OperationModes { get; } = Enum.GetNames(typeof(EOperationMode)).ToList();
, который я хотел бы связать с ComboBox
.
реактивный путь | не работает
this.OneWayBind(ViewModel, model => model.OperationModes, window => window.ComboBoxOperationMode.ItemsSource).DisposeWith(r);
![enter image description here](https://i.stack.imgur.com/W1oUR.png)
Если использовать reactiveUI
для привязки list
к ComboBox
, я получаю следующую ошибку в console output
.
консольный вывод
DefaultViewLocator: Failed to resolve view for view model type 'System.Object'.
DefaultViewLocator: Failed to resolve view for view model type 'System.Object'.
ViewModelViewHost: The ViewModelViewHost could not find a valid view for the view model of type System.String and value Passthrough.
xaml way | работает
<ComboBox
x:Name="ComboBoxOperationMode"
ItemsSource="{Binding ViewModel.OperationModes}"/>
![enter image description here](https://i.stack.imgur.com/tkhxQ.png)
Как я могу решить эту проблему? Или невозможно связать list<string>
через reactiveUI
?
Github Issue: https://github.com/reactiveui/ReactiveUI/issues/2008