Should I bind to ICollectionView or ObservableCollection

You always bind to an ICollectionView, whether you make it explicit or not. Assume that we have var collection = new ObservableCollection<string>(); var collectionView = CollectionViewSource.GetDefaultView(collection); In this case, binding to collection or to collectionView is one and the same: the binding engine will bind to the default collection view (which is reference equal to … Read more

WPF MVVM Why use ContentControl + DataTemplate Views rather than straight XAML Window Views?

People use DataTemplates that way when they want to dynamically switch Views depending on the ViewModel: <Window> <Window.Resources> <DataTemplate DataType=”{x:Type local:VM1}”> <!– View 1 Here –> </DataTemplate> <DataTemplate DataType=”{x:Type local:VM2}”> <!– View 2 here –> </DataTemplate> </Window.Resources> <ContentPresenter Content=”{Binding}”/> </Window> So, if Window.DataContext is an instance of VM1, then View1 will be displayed, and if … Read more

Is MVVM pointless? [closed]

Sorry if my answer became a little lenghty, but don’t blame me! Your question is lengthy as well. In summary, MVVM is not pointless. The clear case in point is adding support for a Modal dialog box. The correct way is to put up a dialog box and tie it to a view model. Getting … Read more

Android ViewModel has no zero argument constructor

In my case as I’m using HILT, it was lacking one annotation above the Fragment that has a ViewModel: @AndroidEntryPoint @AndroidEntryPoint class BestFragment : Fragment() { …. Of course in your ViewModel class you also need to Annotate with what HILT needs: @ViewModelInject class BestFragmentViewModel @ViewModelInject constructor(var userManager: UserManager) : ViewModel() { …. }

Why a viewmodel factory is needed in Android?

We can not create ViewModel on our own. We need ViewModelProviders utility provided by Android to create ViewModels. But ViewModelProviders can only instantiate ViewModels with no arg constructor. So if I have a ViewModel with multiple arguments, then I need to use a Factory that I can pass to ViewModelProviders to use when an instance … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)