Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Given Key Not Present in Dictionary Xamarin Forms

$
0
0

I Have a Login ViewModel something like this below

public class LoginViewModel : ViewModelBase
    {

        private readonly IAuthenticationService _authenticationService;

        public LoginViewModel(IAuthenticationService authenticationService)
        {
            _authenticationService = authenticationService;
        }
  }

And i'm Binding like this in XAML

<ContentPage.BindingContext>
    <viewModels:LoginViewModel />
</ContentPage.BindingContext>

When i Compile i'm getting "Given Key Not Present in Dictionary"

But when i add an Empty Constructor to My ViewModel like this

      public LoginViewModel ()
            {

            }

It working fine ,so is there any workaround for this other than instantiating from Code behind of my ViewPage ?


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>