You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
there is a combobox and Its data source is a collection of value types,such as ObservableCollection< int>,when I use the binding method recommended by Reactive UI,like this:
public partial class Page1View : ReactiveUserControl<Page1ViewModel>
{
public Page1View()
{
InitializeComponent();
this.WhenActivated((disposable) =>
{
this.OneWayBind(ViewModel, vm => vm.Channels, v => v.cb2.ItemsSource).DisposeWith(disposable);
});
}
}
The above is the code-behind code.
public partial class Page1ViewModel : RoutableViewModel
{
...
public ObservableCollection<int> Channels { get; }
public Page1ViewModel(IScreen screen) : base(screen)
{
Channels = new(Enumerable.Range(1,10));
}
}
The above is the viewmodel code.
when I start the app,and click the combobox,the app will report an errror:
System.ArgumentException:“GenericArguments[0], 'System.Int32', on 'ReactiveUI.IViewFor`1[T]' violates the constraint of type 'T'.”
So,how can I bind the 'Channels' to combobox by the reactiveUI recommand way?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
there is a combobox and Its data source is a collection of value types,such as ObservableCollection< int>,when I use the binding method recommended by Reactive UI,like this:
The above is the axaml code.
The above is the code-behind code.
The above is the viewmodel code.
when I start the app,and click the combobox,the app will report an errror:
System.ArgumentException:“GenericArguments[0], 'System.Int32', on 'ReactiveUI.IViewFor`1[T]' violates the constraint of type 'T'.”
So,how can I bind the 'Channels' to combobox by the reactiveUI recommand way?
Beta Was this translation helpful? Give feedback.
All reactions