O'Reilly logo

Xamarin Blueprints by Michael Williams

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the custom UI objects

Jump back in the Camera project and let's begin adding a new folder called Controls. Add in a new file called OrientationPage.cs and implement the following:

public class OrientationPage : ContentPage 
    { 
        #region Static Properties 
 
        public static Orientation PageOrientation; 
 
        public static event EventHandler<Orientation> OrientationHandler; 
 
        public static event EventHandler<Point> TouchHandler; 
 
        #endregion 
 
        #region Static Methods 
 
        public static void NotifyOrientationChange(Orientation orientation) 
        { 
            if (OrientationHandler != null) 
            { 
                OrientationHandler (null, orientation); 
            } 
        } 
 
        public static void NotifyTouch(Point touchPoint) 
        { 
            if (TouchHandler != null) 
            { 
                TouchHandler(null, touchPoint); 
            } 
        } 
 
        #endregion 
    } 

In our previous chapter, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required