示例#1
0
        /// <summary>
        /// Base Constructor
        /// </summary>
        /// <param name="manager">ScreenManager</param>
        public TabControl(IScreenManager manager)
            : base(manager)
        {
            Manager = manager;

            Pages = new ItemCollection<TabPage>();
            Pages.OnInsert += OnInsert;
            Pages.OnRemove += OnRemove;

            tabControlStack = new StackPanel(manager);
            tabControlStack.HorizontalAlignment = HorizontalAlignment.Stretch;
            tabControlStack.VerticalAlignment = VerticalAlignment.Stretch;
            Content = tabControlStack;

            tabListStack = new StackPanel(manager);
            tabListStack.HorizontalAlignment = HorizontalAlignment.Stretch;
            tabListStack.Orientation = Orientation.Horizontal;
            tabListStack.Background = TabListBackground;
            tabControlStack.Controls.Add(tabListStack);

            tabPage = new ContentControl(manager);
            tabPage.HorizontalAlignment = HorizontalAlignment.Stretch;
            tabPage.VerticalAlignment = VerticalAlignment.Stretch;
            tabPage.Margin = new Border(0, 10, 0, 10);
            tabPage.Background = TabPageBackground;
            tabControlStack.Controls.Add(tabPage);
            tabPage.Margin = new Border(0, -50, 0, 0);

            ApplySkin(typeof(TabControl));
        }
示例#2
0
        /// <summary>
        /// Base Constructor
        /// </summary>
        /// <param name="manager">ScreenManager</param>
        public TabControl(BaseScreenComponent manager)
            : base(manager)
        {
            Pages = new ItemCollection<TabPage>();
            Pages.OnInsert += OnInsert;
            Pages.OnRemove += OnRemove;

            tabControlGrid = new Grid(manager)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };
            tabControlGrid.Columns.Add(new ColumnDefinition() {ResizeMode = ResizeMode.Parts, Width = 1});
            tabControlGrid.Rows.Add(new RowDefinition() {ResizeMode = ResizeMode.Auto});
            tabControlGrid.Rows.Add(new RowDefinition() {ResizeMode = ResizeMode.Parts, Height =  1});
            Content = tabControlGrid;

            tabListStack = new StackPanel(manager);
            tabListStack.HorizontalAlignment = HorizontalAlignment.Stretch;
            tabListStack.Orientation = Orientation.Horizontal;
            tabListStack.Background = TabListBackground;
            tabControlGrid.AddControl(tabListStack, 0, 0);

            tabPage = new ContentControl(manager);
            tabPage.HorizontalAlignment = HorizontalAlignment.Stretch;
            tabPage.VerticalAlignment = VerticalAlignment.Stretch;
            tabPage.Background = TabPageBackground;
            tabControlGrid.AddControl(tabPage, 0, 1);

            ApplySkin(typeof(TabControl));
        }
        protected override void LoadContent()
        {
            Skin.Pix = new Texture2D(GraphicsDevice, 1, 1);
            Skin.Pix.SetData(new[] { Color.White });

            Skin.Current = new Skin(Game.Content);
            batch = new SpriteBatch(GraphicsDevice);

            root = new ContainerControl(this)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };

            Frame = new ContentControl(this)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };
            root.Controls.Add(Frame);

            ContainerControl screenContainer = new ContainerControl(this)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };
            Frame.Content = screenContainer;
            ScreenTarget = screenContainer;

            flyout = new FlyoutControl(this)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch
            };
            root.Controls.Add(flyout);
        }