Xamarin – A Control’s basic properties in a Layout

In this post we would see, what are the basic properties we should check for while adding a control to the Layout.

We would take a Button control and see what its basic properties are.


Any View object may have an integer ID associated with it, to uniquely identify the View within the tree.

The at-symbol (@) at the beginning of the string indicates that the XML parser should parse and expand the rest of the ID string and identify it as an ID resource.

The plus-symbol (+) means that this is a new resource name that must be created and added to our resources.

Android:layout_width & Android:layout_height

All Controls/Layouts include a width and height (layout_width and layout_height) property, and each view is required to define them. There are two types of constants used such as:

  • fill_parent: To become as big as its parent view group will allow
  • wrap_content: To size itself to the dimensions required by its content

Fixed width and height

To have fixed width and height we could simply put integer numbers instead of the above constants.

Actually Integer types not allowed for width and height properties. Then how do we do it.

Add dp to the numbers you have just added such as 100dp and 80dp


This is a Button control specific property which is content in WPF c#. As you see, it refers to the Resource String named Hello. If we go to the “Strings.xml” we would find that it has a resource in that name.

Hope this article helps, thanks for reading.