public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// Create a TrayManager to handle a collection of "palette"
			// trays. It will automatically close any open tray when 
			// another tray in this collection is opened.
			trayManager = new UIActionTrayManager ();

			// Automatically close the left tray when any tray
			// in the manager's collection is opened
			trayManager.TrayOpened += (tray) => {
				// Animate the tray being closed
				leftTray.CloseTray (true);

				// Are we on an iPhone?
				if (UserInterfaceIdiomIsPhone) {
					// Yes, close the right tray too
					rightTray.CloseTray (true);
				}
			};
			
			// Wireup the left side tray created in the .xib file and style
			// it to be a drag out tray.
			if (leftTray != null) {
				// Set tray type
				leftTray.orientation = UIActionTrayOrientation.Left;
				leftTray.tabLocation=UIActionTrayTabLocation.BottomOrRight;
				leftTray.frameType=UIActionTrayFrameType.EdgeOnly;
				leftTray.tabType=UIActionTrayTabType.IconAndTitle;

				// Style tray
				leftTray.appearance.background=UIColor.DarkGray;
				leftTray.icon=UIImage.FromFile ("Images/icon_calendar.png");
				leftTray.title="Events";
				leftTray.appearance.tabAlpha=0.8f;
				leftTray.CloseTray (false);

				// Respond to the tray being touched
				leftTray.Touched+= (tray) => {
					// Are we on an iPhone?
					if (UserInterfaceIdiomIsPhone) {
						//Yes, close this tray and aminate the closing
						rightTray.CloseTray (true);
					}

					// Tell any open palette trays to close
					trayManager.CloseAllTrays ();

					// Close document tray
					if (documentTray!=null) 
						documentTray.CloseTray (true);
				};
			}

			// Wireup the right tray created in the .xib file and style it
			// to be a popup tray. Touch it's dragTab to open and close it.
			if (rightTray != null) {
				// Are we on an iPhone?
				if (UserInterfaceIdiomIsPhone) {
					// Move the subview into view and attach it to the master view
					rightTray.MoveTo (new PointF(320f-rightTray.Frame.Width,0f));
					View.AddSubview(rightTray);

					// iPhone specific settings
					rightTray.tabLocation=UIActionTrayTabLocation.BottomOrRight;
				}

				// Set tray type
				rightTray.trayType=UIActionTrayType.Popup;
				rightTray.orientation=UIActionTrayOrientation.Right;
				rightTray.bringToFrontOnTouch=true;
				if (UserInterfaceIdiomIsPhone) rightTray.CloseTray(false);

				// Respond to the tray being opened
				rightTray.Opened+= (tray) => {
					//Are we on an iPhone?
					if (UserInterfaceIdiomIsPhone) {
						//Yes, close this tray and aminate the closing
						leftTray.CloseTray (true);
					}

					// Tell any open palette trays to close
					trayManager.CloseAllTrays ();

					// Close document tray
					if (documentTray!=null) 
						documentTray.CloseTray (true);
				};
			}

			// Wireup the document tray created in the .xib file and style it
			// to be an auto closing popup. When the user selects something
			// from it's content area, it is automatically closed.
			if (documentTray != null) {
				// Set tray type
				documentTray.trayType=UIActionTrayType.AutoClosingPopup;
				documentTray.orientation = UIActionTrayOrientation.Bottom;
				documentTray.tabType=UIActionTrayTabType.GripAndTitle;

				// Style tray
				documentTray.tabWidth=125f;
				documentTray.title="Documents";
				documentTray.CloseTray (false);

				// Respond to the tray being opened
				documentTray.Opened += (tray) => {
					// Close left and right trays
					leftTray.CloseTray(true);
					rightTray.CloseTray(true);
				};
			}

			// Palette 1
			// Wireup the 1st palette from the .xib file and style it
			// to be an auto closing popup. When the user selects something
			// from it's content area, it is automatically closed.
			if (paletteTray != null) {
				// Are we on an iPhone?
				if (UserInterfaceIdiomIsPhone) {
					// Move the subview into view and attach it to the master view
					paletteTray.MoveTo (new PointF(0,0));
					View.AddSubview(paletteTray);

					// Adjust tab location
					paletteTray.tabLocation=UIActionTrayTabLocation.Custom;
					paletteTray.tabOffset=55f;

					//iPhone specific settings
					paletteTray.orientation=UIActionTrayOrientation.Right;
				} else {
					// iPad specific settings
					paletteTray.tabLocation=UIActionTrayTabLocation.TopOrLeft;
					paletteTray.orientation=UIActionTrayOrientation.Top;
				}

				// Set tray type
				paletteTray.trayType=UIActionTrayType.AutoClosingPopup;
				paletteTray.tabType=UIActionTrayTabType.IconAndTitle;
				paletteTray.CloseTray (false);

				// Style tray
				paletteTray.tabWidth=125f;
				paletteTray.icon=UIImage.FromFile ("Images/icon_palette.png");
				paletteTray.title="Palette";

				// Add this tray to the manager's collection
				trayManager.AddTray (paletteTray);
			}

			// Palette 2
			// Wireup the 2nd palette from the .xib file and style it
			// to be a popup tray. Touch it's dragTab to open and close it.
			if (propertyTray != null) {
				// Are we on an iPhone?
				if (UserInterfaceIdiomIsPhone) {
					// Move subview into view and attach it to the master view
					propertyTray.MoveTo(new PointF(0,170));
					View.AddSubview(propertyTray);

					// iPhone specific settings
					propertyTray.orientation=UIActionTrayOrientation.Right;
				} else {
					// iPad specific settings
					propertyTray.orientation=UIActionTrayOrientation.Top;
				}

				// Set tray type
				propertyTray.trayType=UIActionTrayType.Popup;
				propertyTray.tabLocation=UIActionTrayTabLocation.TopOrLeft;
				propertyTray.tabType=UIActionTrayTabType.IconAndTitle;
				propertyTray.CloseTray (false);
				
				// Style tray
				propertyTray.tabWidth=125f;
				propertyTray.icon=UIImage.FromFile ("Images/icon_measures.png");
				propertyTray.title="Properties";

				// Add this tray to the manager's collection
				trayManager.AddTray (propertyTray);
			}

			// Palette 3
			// Wireup the 3rd palette from the .xib file and style it 
			// to be an auto closing popup. When the user selects something
			// from it's content area, it is automatically closed.
			if (toolsTray != null) {
				// Are we on an iPhone?
				if (UserInterfaceIdiomIsPhone) {
					// Move the subview into view and attach it to the master view
					toolsTray.MoveTo (new PointF(0,0));
					View.AddSubview(toolsTray);

					// Adjust tab location
					toolsTray.tabLocation=UIActionTrayTabLocation.Custom;
					toolsTray.tabOffset=5f;

					// iPhone specific settings
					toolsTray.orientation=UIActionTrayOrientation.Right;
				} else {
					// iPad specific settings
					toolsTray.orientation=UIActionTrayOrientation.Top;
				}

				// Set tray type
				toolsTray.trayType=UIActionTrayType.AutoClosingPopup;
				toolsTray.tabType=UIActionTrayTabType.IconOnly;
				toolsTray.tabType=UIActionTrayTabType.CustomDrawn;
				toolsTray.CloseTray (false);
				
				// Style tray
				toolsTray.tabWidth=50f;
				toolsTray.appearance.background=UIColor.FromRGB (38,38,38);

				// Custom draw the tray's drag tab
				toolsTray.CustomDrawDragTab+= (tray, rect) => {
					// Mix background color
					UIColor tabColor;
					
					if (tray.frameType==UIActionTrayFrameType.None) {
						tabColor=tray.appearance.background.ColorWithAlpha (tray.appearance.tabAlpha);
					} else {
						tabColor=tray.appearance.frame.ColorWithAlpha (tray.appearance.tabAlpha);
					}

					// Save current context
					var context = UIGraphics.GetCurrentContext();

					// Draw tab in the given bounds
					var bodyPath = UIBezierPath.FromRect(rect);
					tabColor.SetFill();
					bodyPath.Fill();

					// Draw icon
					var icon=UIImage.FromFile ("Images/icon_pencil.png");
					var y=rect.GetMinY()+5f;
					var tabIconRect = new RectangleF(rect.GetMinX() + 1, y, 30, 30);
					var tabIconPath = UIBezierPath.FromRect(tabIconRect);
					context.SaveState();
					tabIconPath.AddClip();
					icon.Draw(new RectangleF((float)Math.Floor(tabIconRect.GetMinX() + 1f), (float)Math.Floor(y + 0.5f), icon.Size.Width, icon.Size.Height),CGBlendMode.Normal,tray.appearance.tabAlpha);
					context.RestoreState();
				};

				// Add this tray to the manager's collection
				trayManager.AddTray (toolsTray);
			}

		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Create a TrayManager to handle a collection of "palette"
            // trays. It will automatically close any open tray when
            // another tray in this collection is opened.
            trayManager = new UIActionTrayManager();

            // Automatically close the left tray when any tray
            // in the manager's collection is opened
            trayManager.TrayOpened += (tray) => {
                // Animate the tray being closed
                leftTray.CloseTray(true);

                // Are we on an iPhone?
                if (UserInterfaceIdiomIsPhone)
                {
                    // Yes, close the right tray too
                    rightTray.CloseTray(true);
                }
            };

            // Wireup the left side tray created in the .xib file and style
            // it to be a drag out tray.
            if (leftTray != null)
            {
                // Set tray type
                leftTray.orientation = UIActionTrayOrientation.Left;
                leftTray.tabLocation = UIActionTrayTabLocation.BottomOrRight;
                leftTray.frameType   = UIActionTrayFrameType.EdgeOnly;
                leftTray.tabType     = UIActionTrayTabType.IconAndTitle;

                // Style tray
                leftTray.appearance.background = UIColor.DarkGray;
                leftTray.icon  = UIImage.FromFile("Images/icon_calendar.png");
                leftTray.title = "Events";
                leftTray.appearance.tabAlpha = 0.8f;
                leftTray.CloseTray(false);

                // Respond to the tray being touched
                leftTray.Touched += (tray) => {
                    // Are we on an iPhone?
                    if (UserInterfaceIdiomIsPhone)
                    {
                        //Yes, close this tray and aminate the closing
                        rightTray.CloseTray(true);
                    }

                    // Tell any open palette trays to close
                    trayManager.CloseAllTrays();

                    // Close document tray
                    if (documentTray != null)
                    {
                        documentTray.CloseTray(true);
                    }
                };
            }

            // Wireup the right tray created in the .xib file and style it
            // to be a popup tray. Touch it's dragTab to open and close it.
            if (rightTray != null)
            {
                // Are we on an iPhone?
                if (UserInterfaceIdiomIsPhone)
                {
                    // Move the subview into view and attach it to the master view
                    rightTray.MoveTo(new PointF(320f - rightTray.Frame.Width, 0f));
                    View.AddSubview(rightTray);

                    // iPhone specific settings
                    rightTray.tabLocation = UIActionTrayTabLocation.BottomOrRight;
                }

                // Set tray type
                rightTray.trayType            = UIActionTrayType.Popup;
                rightTray.orientation         = UIActionTrayOrientation.Right;
                rightTray.bringToFrontOnTouch = true;
                if (UserInterfaceIdiomIsPhone)
                {
                    rightTray.CloseTray(false);
                }

                // Respond to the tray being opened
                rightTray.Opened += (tray) => {
                    //Are we on an iPhone?
                    if (UserInterfaceIdiomIsPhone)
                    {
                        //Yes, close this tray and aminate the closing
                        leftTray.CloseTray(true);
                    }

                    // Tell any open palette trays to close
                    trayManager.CloseAllTrays();

                    // Close document tray
                    if (documentTray != null)
                    {
                        documentTray.CloseTray(true);
                    }
                };
            }

            // Wireup the document tray created in the .xib file and style it
            // to be an auto closing popup. When the user selects something
            // from it's content area, it is automatically closed.
            if (documentTray != null)
            {
                // Set tray type
                documentTray.trayType    = UIActionTrayType.AutoClosingPopup;
                documentTray.orientation = UIActionTrayOrientation.Bottom;
                documentTray.tabType     = UIActionTrayTabType.GripAndTitle;

                // Style tray
                documentTray.tabWidth = 125f;
                documentTray.title    = "Documents";
                documentTray.CloseTray(false);

                // Respond to the tray being opened
                documentTray.Opened += (tray) => {
                    // Close left and right trays
                    leftTray.CloseTray(true);
                    rightTray.CloseTray(true);
                };
            }

            // Palette 1
            // Wireup the 1st palette from the .xib file and style it
            // to be an auto closing popup. When the user selects something
            // from it's content area, it is automatically closed.
            if (paletteTray != null)
            {
                // Are we on an iPhone?
                if (UserInterfaceIdiomIsPhone)
                {
                    // Move the subview into view and attach it to the master view
                    paletteTray.MoveTo(new PointF(0, 0));
                    View.AddSubview(paletteTray);

                    // Adjust tab location
                    paletteTray.tabLocation = UIActionTrayTabLocation.Custom;
                    paletteTray.tabOffset   = 55f;

                    //iPhone specific settings
                    paletteTray.orientation = UIActionTrayOrientation.Right;
                }
                else
                {
                    // iPad specific settings
                    paletteTray.tabLocation = UIActionTrayTabLocation.TopOrLeft;
                    paletteTray.orientation = UIActionTrayOrientation.Top;
                }

                // Set tray type
                paletteTray.trayType = UIActionTrayType.AutoClosingPopup;
                paletteTray.tabType  = UIActionTrayTabType.IconAndTitle;
                paletteTray.CloseTray(false);

                // Style tray
                paletteTray.tabWidth = 125f;
                paletteTray.icon     = UIImage.FromFile("Images/icon_palette.png");
                paletteTray.title    = "Palette";

                // Add this tray to the manager's collection
                trayManager.AddTray(paletteTray);
            }

            // Palette 2
            // Wireup the 2nd palette from the .xib file and style it
            // to be a popup tray. Touch it's dragTab to open and close it.
            if (propertyTray != null)
            {
                // Are we on an iPhone?
                if (UserInterfaceIdiomIsPhone)
                {
                    // Move subview into view and attach it to the master view
                    propertyTray.MoveTo(new PointF(0, 170));
                    View.AddSubview(propertyTray);

                    // iPhone specific settings
                    propertyTray.orientation = UIActionTrayOrientation.Right;
                }
                else
                {
                    // iPad specific settings
                    propertyTray.orientation = UIActionTrayOrientation.Top;
                }

                // Set tray type
                propertyTray.trayType    = UIActionTrayType.Popup;
                propertyTray.tabLocation = UIActionTrayTabLocation.TopOrLeft;
                propertyTray.tabType     = UIActionTrayTabType.IconAndTitle;
                propertyTray.CloseTray(false);

                // Style tray
                propertyTray.tabWidth = 125f;
                propertyTray.icon     = UIImage.FromFile("Images/icon_measures.png");
                propertyTray.title    = "Properties";

                // Add this tray to the manager's collection
                trayManager.AddTray(propertyTray);
            }

            // Palette 3
            // Wireup the 3rd palette from the .xib file and style it
            // to be an auto closing popup. When the user selects something
            // from it's content area, it is automatically closed.
            if (toolsTray != null)
            {
                // Are we on an iPhone?
                if (UserInterfaceIdiomIsPhone)
                {
                    // Move the subview into view and attach it to the master view
                    toolsTray.MoveTo(new PointF(0, 0));
                    View.AddSubview(toolsTray);

                    // Adjust tab location
                    toolsTray.tabLocation = UIActionTrayTabLocation.Custom;
                    toolsTray.tabOffset   = 5f;

                    // iPhone specific settings
                    toolsTray.orientation = UIActionTrayOrientation.Right;
                }
                else
                {
                    // iPad specific settings
                    toolsTray.orientation = UIActionTrayOrientation.Top;
                }

                // Set tray type
                toolsTray.trayType = UIActionTrayType.AutoClosingPopup;
                toolsTray.tabType  = UIActionTrayTabType.IconOnly;
                toolsTray.tabType  = UIActionTrayTabType.CustomDrawn;
                toolsTray.CloseTray(false);

                // Style tray
                toolsTray.tabWidth = 50f;
                toolsTray.appearance.background = UIColor.FromRGB(38, 38, 38);

                // Custom draw the tray's drag tab
                toolsTray.CustomDrawDragTab += (tray, rect) => {
                    // Mix background color
                    UIColor tabColor;

                    if (tray.frameType == UIActionTrayFrameType.None)
                    {
                        tabColor = tray.appearance.background.ColorWithAlpha(tray.appearance.tabAlpha);
                    }
                    else
                    {
                        tabColor = tray.appearance.frame.ColorWithAlpha(tray.appearance.tabAlpha);
                    }

                    // Save current context
                    var context = UIGraphics.GetCurrentContext();

                    // Draw tab in the given bounds
                    var bodyPath = UIBezierPath.FromRect(rect);
                    tabColor.SetFill();
                    bodyPath.Fill();

                    // Draw icon
                    var icon        = UIImage.FromFile("Images/icon_pencil.png");
                    var y           = rect.GetMinY() + 5f;
                    var tabIconRect = new RectangleF(rect.GetMinX() + 1, y, 30, 30);
                    var tabIconPath = UIBezierPath.FromRect(tabIconRect);
                    context.SaveState();
                    tabIconPath.AddClip();
                    icon.Draw(new RectangleF((float)Math.Floor(tabIconRect.GetMinX() + 1f), (float)Math.Floor(y + 0.5f), icon.Size.Width, icon.Size.Height), CGBlendMode.Normal, tray.appearance.tabAlpha);
                    context.RestoreState();
                };

                // Add this tray to the manager's collection
                trayManager.AddTray(toolsTray);
            }
        }
Exemple #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Gain Access to all views and controls in our layout
            leftTray     = FindViewById <UIActionTray> (Resource.Id.trayLeft);
            rightTray    = FindViewById <UIActionTray> (Resource.Id.trayRight);
            toolsTray    = FindViewById <UIActionTray> (Resource.Id.trayTools);
            propertyTray = FindViewById <UIActionTray> (Resource.Id.trayProperty);
            paletteTray  = FindViewById <UIActionTray> (Resource.Id.trayPalette);
            documentTray = FindViewById <UIActionTray> (Resource.Id.trayDocuments);

            // Create a TrayManager to handle a collection of "palette"
            // trays. It will automatically close any open tray when
            // another tray in this collection is opened.
            trayManager = new UIActionTrayManager();

            // Automatically close the left and right trays when any tray
            // in the manager's collection is opened
            trayManager.TrayOpened += (tray) => {
                // Animate the trays being closed
                leftTray.CloseTray(true);
                rightTray.CloseTray(true);
            };

            // Setup the left side tray
            leftTray.trayType            = UIActionTrayType.Draggable;
            leftTray.orientation         = UIActionTrayOrientation.Left;
            leftTray.tabLocation         = UIActionTrayTabLocation.BottomOrRight;
            leftTray.frameType           = UIActionTrayFrameType.EdgeOnly;
            leftTray.tabType             = UIActionTrayTabType.IconAndTitle;
            leftTray.bringToFrontOnTouch = true;

            // Style tray
            leftTray.appearance.background = Color.Gray;
            leftTray.appearance.border     = Color.Red;
            leftTray.icon  = Resource.Drawable.icon_calendar;
            leftTray.title = "Events";
            leftTray.appearance.tabAlpha = 100;
            leftTray.CloseTray(false);

            // Respond to the left tray being touched
            leftTray.Touched += (tray) => {
                //Yes, close this tray and aminate the closing
                rightTray.CloseTray(true);

                // Tell any open palette trays to close
                trayManager.CloseAllTrays();

                // Close document tray
                documentTray.CloseTray(true);
            };

            // Setup the right side tray
            rightTray.trayType            = UIActionTrayType.Popup;
            rightTray.orientation         = UIActionTrayOrientation.Right;
            rightTray.bringToFrontOnTouch = true;
            rightTray.CloseTray(false);

            // Respond to the tray being opened
            rightTray.Opened += (tray) => {
                //Close this tray and aminate the closing
                leftTray.CloseTray(true);

                // Tell any open palette trays to close
                trayManager.CloseAllTrays();

                // Close document tray
                documentTray.CloseTray(true);
            };

            // Set tray type
            documentTray.trayType            = UIActionTrayType.AutoClosingPopup;
            documentTray.orientation         = UIActionTrayOrientation.Bottom;
            documentTray.tabType             = UIActionTrayTabType.GripAndTitle;
            documentTray.bringToFrontOnTouch = true;

            // Style tray
            documentTray.tabWidth = 125;
            documentTray.appearance.background = Color.Gray;
            documentTray.title = "Documents";
            documentTray.CloseTray(false);

            // Respond to the tray being opened
            documentTray.Opened += (tray) => {
                // Close left and right trays
                leftTray.CloseTray(true);
                rightTray.CloseTray(true);
            };

            //--------------------------------------------------------------------------------------
            // Create three action tray's and use them as a collection via an ActionTrayManager
            //--------------------------------------------------------------------------------------

            //--------------------------------------------------------------------------------------
            // Palette 1
            // Set tray type
            paletteTray.trayType    = UIActionTrayType.AutoClosingPopup;
            paletteTray.orientation = UIActionTrayOrientation.Top;
            paletteTray.tabLocation = UIActionTrayTabLocation.TopOrLeft;
            paletteTray.tabType     = UIActionTrayTabType.IconAndTitle;
            paletteTray.CloseTray(false);

            // Style tray
            paletteTray.tabWidth = 125;
            paletteTray.appearance.background = Color.Gray;
            paletteTray.icon  = Resource.Drawable.icon_palette;
            paletteTray.title = "Palette";

            // Add this tray to the manager's collection
            trayManager.AddTray(paletteTray);

            //--------------------------------------------------------------------------------------
            // Palette 2
            // Setup property tray type
            propertyTray.trayType    = UIActionTrayType.Popup;
            propertyTray.orientation = UIActionTrayOrientation.Top;
            propertyTray.tabLocation = UIActionTrayTabLocation.TopOrLeft;
            propertyTray.tabType     = UIActionTrayTabType.IconAndTitle;
            propertyTray.CloseTray(false);

            // Style tray
            propertyTray.tabWidth = 125;
            propertyTray.appearance.background = Color.Rgb(38, 38, 38);
            propertyTray.icon  = Resource.Drawable.icon_measures;
            propertyTray.title = "Properties";

            // Add this tray to the manager's collection
            trayManager.AddTray(propertyTray);

            //--------------------------------------------------------------------------------------
            // Palette 3
            // Setup tools tray type
            toolsTray.trayType    = UIActionTrayType.AutoClosingPopup;
            toolsTray.orientation = UIActionTrayOrientation.Top;
            toolsTray.tabType     = UIActionTrayTabType.IconOnly;
            toolsTray.CloseTray(false);

            // Style tools tray
            toolsTray.tabWidth              = 50;
            toolsTray.tabLocation           = UIActionTrayTabLocation.BottomOrRight;
            toolsTray.appearance.background = Color.Rgb(38, 38, 38);
            toolsTray.tabType = UIActionTrayTabType.CustomDrawn;
            toolsTray.icon    = Resource.Drawable.icon_pencil;

            // Custom draw this tab
            toolsTray.CustomDrawDragTab += (tray, canvas, rect) => {
                //Draw background
                var body = new ShapeDrawable(new RectShape());
                body.Paint.Color = tray.appearance.background;
                body.SetBounds(rect.Left, rect.Top, rect.Right, rect.Bottom);
                body.Draw(canvas);

                //Define icon paint
                var iPaint = new Paint();
                iPaint.Alpha = tray.appearance.tabAlpha;

                //Load bitmap
                var bitmap = BitmapFactory.DecodeResource(Resources, tray.icon);

                //Draw image
                canvas.DrawBitmap(bitmap, rect.Left + 1, rect.Top + 5, iPaint);
            };

            // Add this tray to the manager's collection
            trayManager.AddTray(toolsTray);
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			// Gain Access to all views and controls in our layout
			leftTray = FindViewById<UIActionTray> (Resource.Id.trayLeft);
			rightTray = FindViewById<UIActionTray> (Resource.Id.trayRight);
			toolsTray = FindViewById<UIActionTray> (Resource.Id.trayTools);
			propertyTray = FindViewById<UIActionTray> (Resource.Id.trayProperty);
			paletteTray = FindViewById<UIActionTray> (Resource.Id.trayPalette);
			documentTray = FindViewById<UIActionTray> (Resource.Id.trayDocuments);

			// Create a TrayManager to handle a collection of "palette"
			// trays. It will automatically close any open tray when 
			// another tray in this collection is opened.
			trayManager = new UIActionTrayManager ();

			// Automatically close the left and right trays when any tray
			// in the manager's collection is opened
			trayManager.TrayOpened += (tray) => {
				// Animate the trays being closed
				leftTray.CloseTray (true);
				rightTray.CloseTray (true);
			};

			// Setup the left side tray
			leftTray.trayType = UIActionTrayType.Draggable;
			leftTray.orientation = UIActionTrayOrientation.Left;
			leftTray.tabLocation = UIActionTrayTabLocation.BottomOrRight;
			leftTray.frameType = UIActionTrayFrameType.EdgeOnly;
			leftTray.tabType = UIActionTrayTabType.IconAndTitle;
			leftTray.bringToFrontOnTouch=true;

			// Style tray
			leftTray.appearance.background = Color.Gray;
			leftTray.appearance.border = Color.Red;
			leftTray.icon = Resource.Drawable.icon_calendar;
			leftTray.title = "Events";
			leftTray.appearance.tabAlpha=100;
			leftTray.CloseTray (false);

			// Respond to the left tray being touched
			leftTray.Touched+= (tray) => {
				//Yes, close this tray and aminate the closing
				rightTray.CloseTray (true);
				
				// Tell any open palette trays to close
				trayManager.CloseAllTrays ();
				
				// Close document tray
				documentTray.CloseTray (true);
			};

			// Setup the right side tray
			rightTray.trayType = UIActionTrayType.Popup;
			rightTray.orientation = UIActionTrayOrientation.Right;
			rightTray.bringToFrontOnTouch = true;
			rightTray.CloseTray (false);

			// Respond to the tray being opened
			rightTray.Opened+= (tray) => {
				//Close this tray and aminate the closing
				leftTray.CloseTray (true);
				
				// Tell any open palette trays to close
				trayManager.CloseAllTrays ();
				
				// Close document tray
				documentTray.CloseTray (true);
			};

			// Set tray type
			documentTray.trayType = UIActionTrayType.AutoClosingPopup;
			documentTray.orientation = UIActionTrayOrientation.Bottom;
			documentTray.tabType = UIActionTrayTabType.GripAndTitle;
			documentTray.bringToFrontOnTouch=true;
			
			// Style tray
			documentTray.tabWidth = 125;
			documentTray.appearance.background = Color.Gray;
			documentTray.title = "Documents";
			documentTray.CloseTray (false);
			
			// Respond to the tray being opened
			documentTray.Opened += (tray) => {
				// Close left and right trays
				leftTray.CloseTray(true);
				rightTray.CloseTray(true);
			};

			//--------------------------------------------------------------------------------------
			// Create three action tray's and use them as a collection via an ActionTrayManager
			//--------------------------------------------------------------------------------------

			//--------------------------------------------------------------------------------------
			// Palette 1
			// Set tray type
			paletteTray.trayType = UIActionTrayType.AutoClosingPopup;
			paletteTray.orientation = UIActionTrayOrientation.Top;
			paletteTray.tabLocation = UIActionTrayTabLocation.TopOrLeft;
			paletteTray.tabType = UIActionTrayTabType.IconAndTitle;
			paletteTray.CloseTray (false);
			
			// Style tray
			paletteTray.tabWidth = 125;
			paletteTray.appearance.background = Color.Gray;
			paletteTray.icon = Resource.Drawable.icon_palette;
			paletteTray.title="Palette";
			
			// Add this tray to the manager's collection
			trayManager.AddTray (paletteTray);

			//--------------------------------------------------------------------------------------
			// Palette 2
			// Setup property tray type
			propertyTray.trayType = UIActionTrayType.Popup;
			propertyTray.orientation = UIActionTrayOrientation.Top;
			propertyTray.tabLocation = UIActionTrayTabLocation.TopOrLeft;
			propertyTray.tabType = UIActionTrayTabType.IconAndTitle;
			propertyTray.CloseTray (false);
			
			// Style tray
			propertyTray.tabWidth = 125;
			propertyTray.appearance.background = Color.Rgb (38,38,38);
			propertyTray.icon=Resource.Drawable.icon_measures;
			propertyTray.title="Properties";
			
			// Add this tray to the manager's collection
			trayManager.AddTray (propertyTray);

			//--------------------------------------------------------------------------------------
			// Palette 3
			// Setup tools tray type
			toolsTray.trayType = UIActionTrayType.AutoClosingPopup;
			toolsTray.orientation = UIActionTrayOrientation.Top;
			toolsTray.tabType = UIActionTrayTabType.IconOnly;
			toolsTray.CloseTray (false);
			
			// Style tools tray
			toolsTray.tabWidth = 50;
			toolsTray.tabLocation = UIActionTrayTabLocation.BottomOrRight;
			toolsTray.appearance.background = Color.Rgb (38,38,38);
			toolsTray.tabType = UIActionTrayTabType.CustomDrawn;
			toolsTray.icon = Resource.Drawable.icon_pencil;

			// Custom draw this tab
			toolsTray.CustomDrawDragTab += (tray, canvas, rect) => {
				//Draw background
				var body= new ShapeDrawable(new RectShape());
				body.Paint.Color=tray.appearance.background;
				body.SetBounds (rect.Left, rect.Top, rect.Right, rect.Bottom);
				body.Draw (canvas);

				//Define icon paint
				var iPaint=new Paint();
				iPaint.Alpha=tray.appearance.tabAlpha;

				//Load bitmap
				var bitmap=BitmapFactory.DecodeResource(Resources,tray.icon);
				
				//Draw image
				canvas.DrawBitmap (bitmap, rect.Left+1, rect.Top+5, iPaint);
			};
			
			// Add this tray to the manager's collection
			trayManager.AddTray (toolsTray);
		}