Learn how to work with buttons from XAML. Discover how to wire up events, and then apply that to have buttons in your application.
- [Instructor] Now that we've got XAML working in our app,…it's time to start introducing some proper design.…Remember that the app we're planning to build…is going to keep track of background color changes…to a label, with the option to undo and redo those changes.…We already have a label to change,…so let's set the background color of that label.…We start this by adding another do binding,…and call helloLabel the BackgroundColor,…and we use mutable assignment to set the color to red.…Before we continue, let's go ahead and clean up…some of these tabs up here.…
Now that our background color is being set,…we'll need buttons to be able to change it programmatically.…So let's head over to our XAML code.…So we'll add it here under the label,…The most simple XAML code for a button…will contain three attributes.…First x:Name,…in this case buttonRed,…then Text…which is what the button will display, in our case, Red,…and finally Clicked,…which is the name of the function to call…when the button is clicked.…
We can use OnButtonRedClicked.…
Released
3/29/2017- Developing in F#
- Developing in Xamarin
- Developing in XAML
- Using Paket
- Creating an application
- Adding buttons and views
- Asynchronous workflows
- Adding a mailbox processor to an app
- Modifying the core code
- Adding a reply feature to an app
Share this video
Embed this video
Video: Common elements: Buttons