#StackBounty: #c# #xamarin #xamarin.forms Binding issue on properties with get; vs with get; set; in Xamarin.Android

Bounty: 100

I have a XF app. In my ViewModel I have the following:

public ICommand ActBtnCmd { get; }
public ICommand AdpBtnCmd { get; }

public SettingsTabViewModel(SettingsTabPage settingsTabPage)
   ActBtnCmd = new Command<Templates.Button>((btn) => MessagingCenter.Send(this, "ActBtn", btn));
   AdpBtnCmd = new Command<Templates.Button>((btn) => MessagingCenter.Send(this, "AdpBtn", btn));

And in my XAML:

<t:Button Text="{Binding ActBtnText}" 
          TapCommand="{Binding ActBtnCmd}" 
          Theme="{Binding Theme}" />

Debugging in iOS is no problem. But when I debug the app in Android I get these messages in Application Output window:

Binding: 'ActBtnCmd' property not found on 'xxx.SettingsTabViewModel', target property: 'xxx.Templates.Button.TapCommand'
Binding: 'AdpBtnCmd' property not found on 'xxx.SettingsTabViewModel', target property: 'xxx.Templates.Button.TapCommand'

But when I changed my property like below then the messages are gone:

public ICommand ActBtnCmd { get; set; }
public ICommand AdpBtnCmd { get; set; }

Can anyone explain to me why am I getting these messages? And why am I only getting it in Android?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.