private void LoadHeaderView()
        {
            NavigationDrawer = new SFNavigationDrawer
            {
                BackgroundColor = UIColor.Clear,
                ContentView     = content
            };

            menuButton = new UIButton();
            menuButton.SetBackgroundImage(new UIImage("Images/menu.png"), UIControlState.Normal);

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                NavigationDrawer.DrawerWidth = (this.View.Bounds.Width * 40) / 100;
            }
            else
            {
                NavigationDrawer.DrawerWidth = (this.View.Bounds.Width * 75) / 100;
            }

            NavigationDrawer.DrawerHeight = this.View.Bounds.Height;

            HeaderView = new UIView
            {
                BackgroundColor = UIColor.FromRGBA(249.0f / 255.0f, 78.0f / 255.0f, 56.0f / 255.0f, 0.97f)
            };

            userImg = new UIImageView
            {
                Image = new UIImage("Controls/synclogo.png")
            };

            version = new UILabel
            {
                Text          = "Version " + NSUserDefaults.StandardUserDefaults.ValueForKey(new NSString("VersionNumber")),
                Font          = UIFont.FromName("Helvetica", 12f),
                TextColor     = UIColor.White,
                TextAlignment = UITextAlignment.Left
            };
            HeaderView.AddSubview(version);

            yellowSeperater = new UIView
            {
                BackgroundColor = UIColor.FromRGB(255.0f / 255.0f, 198.0f / 255.0f, 14.0f / 255.0f)
            };
            HeaderView.AddSubview(yellowSeperater);

            headerDetails = new UILabel
            {
                LineBreakMode = UILineBreakMode.WordWrap,
                Lines         = 0,
                Text          = "The toolkit contains all the components that are typically required for building line-of-business applications for IOS",
                TextColor     = UIColor.White,
                Font          = UIFont.FromName("Helvetica", 18f)
            };
            HeaderView.AddSubview(headerDetails);

            HeaderView.AddSubview(userImg);

            Table = new UITableView(new CGRect(0, 20, NavigationDrawer.DrawerWidth, this.View.Frame.Height))
            {
                SeparatorColor = UIColor.Clear
            };

            NavigationTableSource tablesource = new NavigationTableSource(this, GetTableItems())
            {
                Customize = false
            };

            Table.Source          = tablesource;
            Table.BackgroundColor = UIColor.Clear;
            centerview            = new UIView
            {
                Table
            };

            centerview.BackgroundColor = UIColor.Clear;

            NavigationDrawer.Position = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft;

            menuButton.TouchDown += (object sender, System.EventArgs e) =>
            {
                HideDrawer(false);
            };

            header = new UIView
            {
                BackgroundColor = UIColor.FromRGB(0, 122.0f / 255.0f, 238.0f / 255.0f)
            };

            title = new UILabel
            {
                TextColor = UIColor.White,
                Text      = "Syncfusion Xamarin Samples",
                Font      = UIFont.FromName("HelveticaNeue-Medium", 16f)
            };

            flowLayoutAllControls = new UICollectionViewFlowLayout
            {
                MinimumLineSpacing = 5,
                ScrollDirection    = UICollectionViewScrollDirection.Vertical
            };

            collectionViewAllControls = new UICollectionView(CGRect.Empty, flowLayoutAllControls);
            collectionViewAllControls.RegisterClassForCell(typeof(UICollectionViewCell), "controlCell");
            collectionViewAllControls.DataSource      = new AllControlsCollectionSource(Controls);
            collectionViewAllControls.Delegate        = new AllControlsCollectionDelegate(this);
            collectionViewAllControls.BackgroundColor = Utility.BackgroundColor;

            UINib nibAllControls = UINib.FromName("ControlCell_9", null);

            collectionViewAllControls.RegisterNibForCell(nibAllControls, "controlCell");

            BottomBorder = new CALayer
            {
                BorderWidth = 1,
                BorderColor = UIColor.FromRGB(213.0f / 255.0f, 213.0f / 255.0f, 213.0f / 255.0f).CGColor,
                Hidden      = true
            };

            content.AddSubview(header);
            content.AddSubview(menuButton);
            content.AddSubview(title);
            content.AddSubview(collectionViewAllControls);

            overlay = new CALayer
            {
                ZPosition       = 1000,
                Hidden          = true,
                BackgroundColor = UIColor.FromRGBA(0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 0.05f).CGColor
            };
            content.Layer.AddSublayer(overlay);

            this.View.AddSubview(NavigationDrawer);
        }
Beispiel #2
0
        private void LoadHeaderView()
        {
            //NavigationDrawer
            navigationDrawer = new SFNavigationDrawer();
            navigationDrawer.BackgroundColor = UIColor.Clear;
            navigationDrawer.ContentView     = content;

            menuButton = new UIButton();
            menuButton.SetBackgroundImage(new UIImage("Images/menu.png"), UIControlState.Normal);

            //navigationDrawer.ContentView = this.View;
            if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                navigationDrawer.DrawerWidth = (this.View.Bounds.Width * 40) / 100;
            }
            else
            {
                navigationDrawer.DrawerWidth = (this.View.Bounds.Width * 75) / 100;
            }

            navigationDrawer.DrawerHeight = this.View.Bounds.Height;

            HeaderView = new UIView();

            HeaderView.BackgroundColor = UIColor.FromRGBA(249.0f / 255.0f, 78.0f / 255.0f, 56.0f / 255.0f, 0.97f);

            userImg = new UIImageView();

            userImg.Image = new UIImage("Controls/synclogo.png");

            version               = new UILabel();
            version.Text          = "Version " + NSUserDefaults.StandardUserDefaults.ValueForKey(new NSString("VersionNumber"));
            version.Font          = UIFont.FromName("Helvetica", 12f);
            version.TextColor     = UIColor.White;
            version.TextAlignment = UITextAlignment.Left;
            HeaderView.AddSubview(version);

            yellowSeperater = new UIView();
            yellowSeperater.BackgroundColor = UIColor.FromRGB(255.0f / 255.0f, 198.0f / 255.0f, 14.0f / 255.0f);
            HeaderView.AddSubview(yellowSeperater);

            headerDetails = new UILabel();
            headerDetails.LineBreakMode = UILineBreakMode.WordWrap;
            headerDetails.Lines         = 0;
            headerDetails.Text          = "The toolkit contains all the components that are typically required for building line-of-business applications for IOS";
            headerDetails.TextColor     = UIColor.White;
            headerDetails.Font          = UIFont.FromName("Helvetica", 18f);
            HeaderView.AddSubview(headerDetails);

            HeaderView.AddSubview(userImg);

            //Menu Page Design
            table = new UITableView(new CGRect(0, 20, navigationDrawer.DrawerWidth, this.View.Frame.Height));             // defaults to Plain style
            table.SeparatorColor = UIColor.Clear;
            tableItems           = new string[] { "Product Page", "Whats New", "Documentation" };
            NavigationTableSource tablesource = new NavigationTableSource(this, tableItems);

            tablesource.customise = false;
            table.Source          = tablesource;
            table.BackgroundColor = UIColor.Clear;
            centerview            = new UIView();
            centerview.Add(table);
            centerview.BackgroundColor = UIColor.Clear;

            navigationDrawer.Position = SFNavigationDrawerPosition.SFNavigationDrawerPositionLeft;

            menuButton.TouchDown += (object sender, System.EventArgs e) =>
            {
                HideDrawer(false);
            };

            //Header View

            header = new UIView();
            header.BackgroundColor = UIColor.FromRGB(0, 122.0f / 255.0f, 238.0f / 255.0f);

            title           = new UILabel();
            title.TextColor = UIColor.White;
            title.Text      = "Syncfusion Xamarin Samples";
            title.Font      = UIFont.FromName("HelveticaNeue-Medium", 16f);

            flowLayoutAllControls = new UICollectionViewFlowLayout();
            flowLayoutAllControls.MinimumLineSpacing = 5;
            flowLayoutAllControls.ScrollDirection    = UICollectionViewScrollDirection.Vertical;
            collectionViewAllControls = new UICollectionView(CGRect.Empty, flowLayoutAllControls);
            collectionViewAllControls.RegisterClassForCell(typeof(UICollectionViewCell), "controlCell");
            collectionViewAllControls.DataSource      = new AllControlsCollectionSource(controls);
            collectionViewAllControls.Delegate        = new AllControlsCollectionDelegate(this);
            collectionViewAllControls.BackgroundColor = Utility.backgroundColor;

            UINib nibAllControls = UINib.FromName("ControlCell_9", null);

            collectionViewAllControls.RegisterNibForCell(nibAllControls, "controlCell");

            bottomBorder             = new CALayer();
            bottomBorder.BorderWidth = 1;
            bottomBorder.BorderColor = (UIColor.FromRGB(213.0f / 255.0f, 213.0f / 255.0f, 213.0f / 255.0f)).CGColor;
            bottomBorder.Hidden      = true;

            content.AddSubview(header);
            content.AddSubview(menuButton);
            content.AddSubview(title);
            content.AddSubview(collectionViewAllControls);

            overlay                 = new CALayer();
            overlay.ZPosition       = 1000;
            overlay.Hidden          = true;
            overlay.BackgroundColor = (UIColor.FromRGBA(0.0f / 255.0f, 0.0f / 255.0f, 0.0f / 255.0f, 0.05f)).CGColor;
            content.Layer.AddSublayer(overlay);

            this.View.AddSubview(navigationDrawer);
        }