![]() ![]() ![]() public static string CalculateYourAge(DateTime Dob).This string variable is assigned to the last added label lblAge. In button click event, I am calling this static function by passing the datepicker date value and storing to a string variable. ![]() In the code backend file, I have created a static function, which accepts a date and returns a string I have added a logic to get an age from date into this function. The label name given below is lblAge in order to access these controls from C# code. I had given a click event for the button and date picker name as dtdob. Inside this stack layout, I have added 2 labels,1 datepicker and one button and XAML code is shown below. Add one stack layout with an orientation vertical. For this, open the page and remove that default label. Let’s do some modification in the MainPage. This is the startup page, which is shown below. After clicking OK button you can see three projects are created, i.e., portable, Android and iOS and you can see in the left side file opens in the first page is mentioned as MainPage i.e. In this popup, I have selected Blank App, under UI Technology Xamarin.Forms and PCL as Code sharing Strategy. In it, I have selected Cross Platform->Cross Platform app(Xamain.Forms or Native ) and I gave the name as AgeCalaculate, as shown below.Īfter clicking OK button, you can see a one more popup, as shown below. Now, you can see a pop up asking to select a template to create a project. Let’s start creating a project in Visual Studio by going to Start->New->Project. I know only XAML and C# code, using which I have created an app, which is used to calculate an age by the giving date of birth. Here, I will explain how to create an Android app, using C# and Xamarin forms templates, using Visual Studio 2017 and distribute it locally. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |