CPET15L - Mobile Application Programming

Cards (118)

  • Xamarin
    An open-source platform for building modern and performant applications for iOS, Android, and Windows with .NET
  • Xamarin
    It is an abstraction layer that manages communication of shared code with underlying platform code
  • Xamarin.Android
    A Xamarin framework you can use to create fully native Android apps by using C# in Visual Studio
  • Xamarin.Android app
    • A native Android app that's built by using the Xamarin tools and libraries
    • The UI is created from Xamarin wrappers around native Android views so the app has the look and feel users expect
    • The behavior logic is written in C#
  • Xamarin.Android
    • You can use Visual Studio or Visual Studio for Mac to build Xamarin.Android apps
    • It supports the latest C# features, including generics, async/await, LINQ, and lambda expressions
  • WebView
    A view that displays web pages inside your application
  • Extensible Application Markup Language (XAML)

    A declarative language that can initialize objects and set properties of objects using a language structure that shows hierarchical relationships between multiple objects and a backing type convention that supports extension of types
  • Software development kit (SDK)

    A collection of software development tools in one installable package that facilitate the creation of applications by having a compiler, debugger and perhaps a software framework
  • Xamarin.Forms
    • Allows you to work in one integrated development environment, with one language
    • Create your UI once, and both iOS and Android use that UI definition, including the actions and events you code
    • It isn't rendered in a webview, instead it uses the Android SDK or the iOS SDK to create native controls for native performance
  • Xamarin.Forms Solution Structure
    • Solution Node - The source code is organized within a single solution
    • Shared Code - The .NET Standard class library is the shared code that's referenced by each platform-specific project
    • .Net and NuGet References - The list of references used by the shared library is the .NET and NuGet References
    • Application Definition - New Xamarin.Forms projects include a class that derives from the Application class
    • Head Projects - The platform-specific projects are the "head" projects, one for each platform being built for
  • XAML attributes
    • x:Arguments
    • x:Class
    • x:DataType
    • x:FactoryMethod
    • x:FieldModifier
    • x:Key
    • x:Name
  • Markup language
    A computer language that you can use to introduce various elements in a document by describing elements using predefined tags
  • XAML
    A declarative markup language created by Microsoft to simplify the process of creating the UI in applications
  • Xamarin.Forms XAML is based on the Microsoft 2009 XAML specification, but the elements you declare in the XAML will change
  • Benefits of XAML
    • Division of labor - designers can focus on XAML and programmers can focus on writing the code
    • Tooling friendly - it's possible to use a design tool to create the XAML layout
  • Object Element Syntax
    A standard, well-formed, XML syntax to declare the element to instantiate
  • Namespace
    Used to specify the location of the information needed to instantiate the XAML elements that you declare
  • Type Converter
    Used to convert an XML attribute value to its correct type
  • Complex Type Assignment
    When a simple property setter is not enough, you can use the Property Element form to create a full object with its own property values
  • Slider
    A horizontal bar that can be manipulated by the user to select a double value from a continuous range
  • Slider properties
    • Minimum is the minimum of the range, with a default value of 0
    • Maximum is the maximum of the range, with a default value of 1
    • Value is the slider's value, which can range between Minimum and Maximum and has a default value of 0
  • Property Element form
    Syntax for property assignment that involves breaking the property setter into the parent-child form where the property is expressed in an element tag as Type.PropertyName
  • Type converters are great for simple property settings; however, in some cases, you need to create a full object with its own property values
  • The solution to this problem is to change the property assignment to use an element-based syntax
  • SliderProperty
    • Minimum is the minimum of the range, with a default value of 0
    • Maximum is the maximum of the range, with a default value of 1
    • Value is the slider's value, which can range between Minimum and Maximum and has a default value of 0
  • Internally, the Slider ensures that Minimum is less than Maximum.


    If Minimum or Maximum are ever set so that Minimum is not less than Maximum, an exception is raised
  • Do not use unconstrained horizontal layout options of Center, Start, or End with Slider.

    On both Android and the UWP, the Slider collapses to a bar of zero length, and on iOS, the bar is very short.

    Keep the default HorizontalOptions setting of Fill, and don't use a width of Auto when putting Slider in a Grid layout
  • Slider Appearance Properties
    • Minimum TrackColor is the bar color on the left side of the thumb
    • Maximum TrackColor is the bar color on the right side of the thumb
    • ThumbColor is the thumb color
    • ThumbImageSource is the image to use for the thumb, of type ImageSource
  • Most applications are driven by data. It might be user-generated or downloaded from the internet. The data might be compiled directly into the app. Even games rely heavily on data for scores, leader boards, account tokens, and so on. When your data changes, make sure that what's shown in the UI stays synchronized with what's stored in your code-behind
  • Data Binding
    Connects properties of two objects, called the source and the target.

    The BindingContext property of the target object must be set to the source object.

    SetBinding method (often used in conjunction with the Binding class) must be called on the target object to bind a property of that object to a property of the source object.
  • The target property must be a bindable property, which means that the target object must derive from BindableObject.

    A property of Label such as Text is associated with the bindable property TextProperty
  • Data bindings allow properties of two objects to be linked so that a change in one causes a change in the other.

    This is a very valuable tool, and while data bindings can be defined entirely in code, XAML provides shortcuts and convenience
  • StackLayout
    A layout that organizes its children in a one-dimensional stack, either horizontally or vertically. By default, a StackLayout is oriented vertically. In addition, a StackLayout can be used as a parent layout that contains other child layouts
  • StackLayout
    • Orientation - the direction in which child views are positioned. The default value is Vertical
    • Spacing - the amount of space between each child view. The default value is six device-independent units
    • Alignment - the child view's preferred alignment, which determines its position and size within its parent layout
    • Expansion - indicates if the child view should use extra space, if it's available
  • Grid
    A layout that organizes its children into rows and columns, which can have proportional or absolute sizes.


    By default, a Grid contains one row and one column.

    In addition, a Grid can be used as a parent layout that contains other child layouts.
  • Grid Properties
    • Column - the column alignment of a view within a parent Grid
    • ColumnDefinitions - a list of ColumnDefinition objects that define the width of the grid columns
    • Row - the row alignment of a view within a parent Grid
    • RowDefinitions - a list of RowDefintion objects that define the height of the grid rows
    • RowSpacing - the distance between grid rows
    • RowSpan - the total number of rows that a view spans within a parent Grid
  • AbsoluteLayout
    Used to position and size children using explicit values.

    The position is specified by the upper-left corner of the child relative to the upper-left corner.

    Can also implements a proportional positioning and sizing feature.

    It is able to position children so that they overlap.
  • AbsoluteLayout Properties
    • LayoutBounds - the position and size of a child
    • LayoutFlags - indicates whether properties of the layout bounds used to position and size the child are interpreted proportionally
  • RelativeLayout
    Used to position and size children relative to properties of the layout or sibling elements.

    This allows UIs to be created that scale proportionally across device sizes.

    It is able to position children so that they overlap.
  • ListView
    An important UI component of Android applications; it is used everywhere from short lists of menu options to long lists of contacts or internet favorites.

    It provides a simple way to present a scrolling list of rows that can either be formatted with a built-in style or customized extensively.

    The Xamarin.Forms ListView class is used to present scrollable lists, which can be customized through the use of ViewCell elements