async partial void AddButtonPageClick (UIButton sender) { if (client != null && client.IsConnected) { Output ("Creating tile..."); // remove an old tile try { var tiles = await client.TileManager.GetTilesTaskAsync (); if (tiles.Any (x => x.TileId.AsString () == tileId.AsString ())) { // a tile exists, so remove it await client.TileManager.RemoveTileTaskAsync (tileId); Output ("Removed tile!"); } } catch (BandException ex) { Output ("Error: " + ex.Message); } // create the tile NSError operationError; var tileName = "iOS Sample"; var tileIcon = BandIcon.FromUIImage (UIImage.FromBundle ("tile.png"), out operationError); var smallIcon = BandIcon.FromUIImage (UIImage.FromBundle ("badge.png"), out operationError); var tile = BandTile.Create (tileId, tileName, tileIcon, smallIcon, out operationError); tile.BadgingEnabled = true; // create the button page var textBlock = new TextBlock (PageRect.Create (0, 0, 200, 40), TextBlockFont.Small); textBlock.ElementId = 10; textBlock.Baseline = 25; textBlock.HorizontalAlignment = HorizontalAlignment.Center; textBlock.BaselineAlignment = TextBlockBaselineAlignment.Relative; textBlock.AutoWidth = false; textBlock.Color = BandColor.FromUIColor (UIColor.Red, out operationError); textBlock.Margins = Margins.Create (5, 2, 5, 2); var button = new TextButton (PageRect.Create (0, 0, 200, 40)); button.ElementId = 11; button.HorizontalAlignment = HorizontalAlignment.Center; button.PressedColor = BandColor.FromUIColor (UIColor.Purple, out operationError); button.Margins = Margins.Create (5, 2, 5, 2); var flowPanel = new FlowPanel (PageRect.Create (15, 0, 260, 105)); flowPanel.AddElement (textBlock); flowPanel.AddElement (button); var pageLayout = new PageLayout (); pageLayout.Root = flowPanel; tile.PageLayouts.Add (pageLayout); // add the tile to the band try { Output ("Adding tile..."); await client.TileManager.AddTileTaskAsync (tile); } catch (BandException ex) { Output ("Error: " + ex.Message); } // set the page data try { Output ("Creating page data..."); var pageValues = new PageElementData [] { TextBlockData.Create (textBlock.ElementId, "TextButton sample", out operationError), TextButtonData.Create (button.ElementId, "Press Me", out operationError) }; var page = PageData.Create (barcodePageId, 0, pageValues); await client.TileManager.SetPagesTaskAsync (new[]{ page }, tileId); Output ("Completed custom page!"); } catch (BandException ex) { Output ("Error: " + ex.Message); } } else { Output ("Band is not connected. Please wait...."); } }