Building a Xamarin Forms UI - Code Behind

While XAML is the preferred method for designing a Xamarin Forms UI, whatever can be achieved in XAML can be done using C# in the code-behind file. Building a Xamarin Forms UI - Code Behind looks at manipulating controls in Xamarin Forms UI using C# code. We take a content view from the earlier Layout Containers course and see how to adapt to changing device orientation in the code-behind file.

Source code


Hi, and welcome to this Building a Xamarin Forms UI: Code Behind course. In this course, we manipulate a Xamarin Forms UI with C# in the code-behind file. In Building a Xamarin Forms UI: Layout Containers course, we saw how the Grid layout didn't perform well when moving from portrait to landscape orientation. Now we will rearrange the layout with C# code to better adapt it to whichever orientation the device is in.

This is the first course in the Building a Xamarin Forms UI series focused mainly on C# in the code-behind file. While coding concepts in this course are elementary, you may find it challenging if you are a novice. You should be fine if you come from a programming background other than C#. Completing the Building a Xamarin Forms UI: Layout Containers course before this course would be beneficial. The source code we will start with is available at


My name is Hallam Webber, and I'll be your instructor for this course. When I created this course, all information was current. If you have any feedback, positive or negative, or if you notice anything that needs to be updated or corrected, please reach out to us at Let's get into the code behind.

About the Author
Learning Paths

Hallam is a software architect with over 20 years experience across a wide range of industries. He began his software career as a  Delphi/Interbase disciple but changed his allegiance to Microsoft with its deep and broad ecosystem. While Hallam has designed and crafted custom software utilizing web, mobile and desktop technologies, good quality reliable data is the key to a successful solution. The challenge of quickly turning data into useful information for digestion by humans and machines has led Hallam to specialize in database design and process automation. Showing customers how leverage new technology to change and improve their business processes is one of the key drivers keeping Hallam coming back to the keyboard. 

Covered Topics