I started using the default Xamarin tab project, and the save button is enabed without respect to a new property or member I added, how do make the form respect my new item?

fritterhat-9706 1 Reputation point

I am using the default Xamarin tabbed project, and I successfully added a new member to the item.cs and all the views. The problem is when I "add" a new item the save button stays disabled only while entering data for the default "Title" and "Description" entries, and it does not wait for my new item called "location" to be entered.

Where is disable button property controlled? The data store? The Item view? Not seeing what to change at this point. Please let me know if you need more information or require me to post my code.

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,325 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Cole Xia (Shanghai Wicresoft Co,.Ltd.) 6,751 Reputation points


    Welcome to Microsoft Q&A!

    The status of the Save Button depends on whether the command which bind on it can execute or not .

    Check the code in NewItemViewModel class .

       SaveCommand = new Command(OnSave, ValidateSave);  
        private bool ValidateSave()  
                   return !String.IsNullOrWhiteSpace(text)  
                       && !String.IsNullOrWhiteSpace(description);  

    As the code shown , the button will be only enabled when text and description are both none - empty.

    You can change the logic in this method .

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments