Exemplo n.º 1
0
		public ContentDecorator(ScrollViewer owner)
		{
			this.owner = owner;

			HorizontalAlignment = HorizontalAlignment.Center;
			VerticalAlignment = VerticalAlignment.Center;
		}
Exemplo n.º 2
0
        public void Offset_Should_Be_Coerced_To_Viewport()
        {
            var target = new ScrollViewer();
            target.SetValue(ScrollViewer.ExtentProperty, new Size(20, 20));
            target.SetValue(ScrollViewer.ViewportProperty, new Size(10, 10));
            target.Offset = new Vector(12, 12);

            Assert.Equal(new Vector(10, 10), target.Offset);
        }
Exemplo n.º 3
0
        public void Content_Is_Created()
        {
            var target = new ScrollViewer
            {
                Template = new FuncControlTemplate<ScrollViewer>(CreateTemplate),
                Content = "Foo",
            };

            target.ApplyTemplate();
            ((ContentPresenter)target.Presenter).UpdateChild();

            Assert.IsType<TextBlock>(target.Presenter.Child);
        }
Exemplo n.º 4
0
 private Control CreateTemplate(ScrollViewer control)
 {
     return new Grid
     {
         ColumnDefinitions = new ColumnDefinitions
         {
             new ColumnDefinition(1, GridUnitType.Star),
             new ColumnDefinition(GridLength.Auto),
         },
         RowDefinitions = new RowDefinitions
         {
             new RowDefinition(1, GridUnitType.Star),
             new RowDefinition(GridLength.Auto),
         },
         Children = new Controls
         {
             new ScrollContentPresenter
             {
                 Name = "PART_ContentPresenter",
                 [~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty],
                 [~~ScrollContentPresenter.ExtentProperty] = control[~~ScrollViewer.ExtentProperty],
                 [~~ScrollContentPresenter.OffsetProperty] = control[~~ScrollViewer.OffsetProperty],
                 [~~ScrollContentPresenter.ViewportProperty] = control[~~ScrollViewer.ViewportProperty],
                 [~ScrollContentPresenter.CanScrollHorizontallyProperty] = control[~ScrollViewer.CanScrollHorizontallyProperty],
             },
             new ScrollBar
             {
                 Name = "horizontalScrollBar",
                 Orientation = Orientation.Horizontal,
                 [~RangeBase.MaximumProperty] = control[~ScrollViewer.HorizontalScrollBarMaximumProperty],
                 [~~RangeBase.ValueProperty] = control[~~ScrollViewer.HorizontalScrollBarValueProperty],
                 [~ScrollBar.ViewportSizeProperty] = control[~ScrollViewer.HorizontalScrollBarViewportSizeProperty],
                 [~ScrollBar.VisibilityProperty] = control[~ScrollViewer.HorizontalScrollBarVisibilityProperty],
                 [Grid.RowProperty] = 1,
             },
             new ScrollBar
             {
                 Name = "verticalScrollBar",
                 Orientation = Orientation.Vertical,
                 [~RangeBase.MaximumProperty] = control[~ScrollViewer.VerticalScrollBarMaximumProperty],
                 [~~RangeBase.ValueProperty] = control[~~ScrollViewer.VerticalScrollBarValueProperty],
                 [~ScrollBar.ViewportSizeProperty] = control[~ScrollViewer.VerticalScrollBarViewportSizeProperty],
                 [~ScrollBar.VisibilityProperty] = control[~ScrollViewer.VerticalScrollBarVisibilityProperty],
                 [Grid.ColumnProperty] = 1,
             },
         },
     };
 }
Exemplo n.º 5
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var sprites = Content.Load<SpriteSheet>("UIImages");

            var img1 = new ImageElement { Name = "UV 1 stack panel", Source = (SpriteFromTexture)new Sprite(Content.Load<Texture>("uv")) };
            var img2 = new ImageElement { Name = "UV 2 stack panel", Source = (SpriteFromTexture)new Sprite(Content.Load<Texture>("uv")) };
            img3 = new ImageElement { Name = "UV 3 stack panel", Source = (SpriteFromTexture)new Sprite(Content.Load<Texture>("uv")) };

            stackPanel = new StackPanel { Orientation = Orientation.Vertical };
            stackPanel.Children.Add(img1);
            stackPanel.Children.Add(img2);
            stackPanel.Children.Add(img3);

            var img4 = new ImageElement { Name = "UV grid", Source = (SpriteFromTexture)new Sprite(Content.Load<Texture>("uv")) };
            var img5 = new ImageElement { Name = "UV grid 2", Source = (SpriteFromTexture)new Sprite(Content.Load<Texture>("uv")) };
            var img6 = new ImageElement { Name = "Game screen grid", Source = SpriteFromSheet.Create(sprites, "GameScreen") };

            img4.DependencyProperties.Set(GridBase.ColumnPropertyKey, 0);
            img4.DependencyProperties.Set(GridBase.RowPropertyKey, 0);
            img5.DependencyProperties.Set(GridBase.ColumnPropertyKey, 1);
            img5.DependencyProperties.Set(GridBase.RowPropertyKey, 0);
            img6.DependencyProperties.Set(GridBase.ColumnPropertyKey, 0);
            img6.DependencyProperties.Set(GridBase.RowPropertyKey, 1);
            img6.DependencyProperties.Set(GridBase.ColumnSpanPropertyKey, 2);

            grid = new UniformGrid { Columns = 2, Rows = 2 };
            grid.Children.Add(img4);
            grid.Children.Add(img5);
            grid.Children.Add(img6);

            scrollViewer = new ScrollViewer { Content = grid, ScrollMode = ScrollingMode.HorizontalVertical};

            contentDecorator = new ContentDecorator { Content = scrollViewer };

            UIComponent.Page = new Engine.UIPage { RootElement = contentDecorator };
        }
Exemplo n.º 6
0
        private static Control ScrollViewerTemplate(ScrollViewer control)
        {
            var result = new ScrollContentPresenter
            {
                Name = "PART_ContentPresenter",
                [~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty],
            };

            return result;
        }
Exemplo n.º 7
0
        public void TestScrollOwner()
        {
            var grid = new UniformGrid();
            Assert.AreEqual(null, grid.ScrollOwner);

            var scrollViewer = new ScrollViewer { Content = grid };
            Assert.AreEqual(scrollViewer, grid.ScrollOwner);

            scrollViewer.Content = null;
            Assert.AreEqual(null, grid.ScrollOwner);

            var scrollViewer2 = new ScrollViewer { Content = grid };
            Assert.AreEqual(scrollViewer2, grid.ScrollOwner);
        }
Exemplo n.º 8
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            //this._background = this.GetTemplateChild(BackgroundTemplateContainerName) as ContentControl;

            //if (this._background == null)
            //{
            //    throw new InvalidOperationException("Missing Viewbox with name PART_Background in template.");
            //}

            _container = this.GetTemplateChild(ContainerName) as Panel;

            this._scrollViewer = this.GetTemplateChild(ScrollViewerName) as ScrollViewer;

            if (this._scrollViewer == null)
            {
                throw new InvalidOperationException("Missing ScrollViewer with name PART_ScrollViewer in template.");
            }

            this.ConfigureBackground();
            this.ConfigureScrollViewer();
        }
Exemplo n.º 9
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var random = new Random(0);

            var Sprites = Asset.Load<SpriteSheet>("UIImages");
            var img1 = new ImageElement { Source = new Sprite(Asset.Load<Texture>("uv")) };
            var img2 = new ImageElement { Source = Sprites["GameScreenLeft"] };
            var img3 = new ImageElement { Source = Sprites["GameScreenRight"] };

            stackPanel1 = new StackPanel { Orientation = Orientation.Vertical, ItemVirtualizationEnabled = true };
            stackPanel1.Children.Add(img1);
            stackPanel1.Children.Add(img2);
            stackPanel1.Children.Add(img3);

            stackPanel2 = new StackPanel { Orientation = Orientation.Vertical, ItemVirtualizationEnabled = true };
            for (var i = 0; i < 1000; i++)
                stackPanel2.Children.Add(new Button { Name = "" + i, Height = 75, Content = new TextBlock { Text = "button number " + i, Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15") } });

            stackPanel3 = new StackPanel { Orientation = Orientation.Vertical, ItemVirtualizationEnabled = true, VerticalAlignment = VerticalAlignment.Center };
            for (var i = 0; i < 103; i++)
                stackPanel3.Children.Add(new Button { Name = "" + i, Height = 50 + 500 * random.NextFloat(), Content = new TextBlock { Text = "random button number " + i, Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15") } });

            stackPanel4 = new StackPanel { Orientation = Orientation.Vertical, ItemVirtualizationEnabled = true };
            for (var i = 0; i < 5; i++)
                stackPanel4.Children.Add(new Button { Name = "" + i, Height = i * 30, Content = new TextBlock { Text = "random button number " + i, Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15") } });

            currentStackPanel = stackPanel1;

            scrollViewer = new ScrollViewer { Name = "sv", Content = currentStackPanel, ScrollMode = ScrollingMode.Vertical };

            UIComponent.RootElement = scrollViewer;
        }
Exemplo n.º 10
0
        public override void OnApplyTemplate()
#endif
        {
            base.OnApplyTemplate();
            _scrollViewer = (ScrollViewer)GetTemplateChild("ScrollViewer");

            UpdateInnerMargin();
            RegisterVerticalOffsetChangedHandler();
        }
Exemplo n.º 11
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

              this.part_ScrollViewer = (ScrollViewer)this.GetTemplateChild("PART_SrollViewer");
              this.part_PropertyDescriptionBox = this.GetTemplateChild("PART_PropertyDescriptionBox") as PropertyDescriptionBox;
              this.part_PropertyFilterBox = this.GetTemplateChild("PART_PropertyFilterBox") as PropertyFilterBox;

              if (this.part_PropertyFilterBox != null) this.part_PropertyFilterBox.TextChanged += FlterBoxTextChanged;

              loaded = true;

              if (resetLoadedObject)
              {
            resetLoadedObject = false;
            this.ResetObject(this.SelectedObject);
              }
        }
Exemplo n.º 12
0
 private static System.Collections.ObjectModel.ObservableCollection<object> Get_e_151_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // tabAllConst element
     TabItem tabAllConst = new TabItem();
     tabAllConst.Name = "tabAllConst";
     tabAllConst.Header = "All Constructions";
     // e_152 element
     ScrollViewer e_152 = new ScrollViewer();
     tabAllConst.Content = e_152;
     e_152.Name = "e_152";
     Binding binding_e_152_IsEnabled = new Binding("IsUIEnabled");
     e_152.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_152_IsEnabled);
     // e_153 element
     Grid e_153 = new Grid();
     e_152.Content = e_153;
     e_153.Name = "e_153";
     ColumnDefinition col_e_153_0 = new ColumnDefinition();
     e_153.ColumnDefinitions.Add(col_e_153_0);
     ColumnDefinition col_e_153_1 = new ColumnDefinition();
     e_153.ColumnDefinitions.Add(col_e_153_1);
     Binding binding_e_153_DataContext = new Binding("PlanetBuildingsData");
     e_153.SetBinding(Grid.DataContextProperty, binding_e_153_DataContext);
     items.Add(tabAllConst);
     // tabUnusedRes element
     TabItem tabUnusedRes = new TabItem();
     tabUnusedRes.Name = "tabUnusedRes";
     tabUnusedRes.Header = "Unused Resources";
     // e_154 element
     ScrollViewer e_154 = new ScrollViewer();
     tabUnusedRes.Content = e_154;
     e_154.Name = "e_154";
     Binding binding_e_154_IsEnabled = new Binding("IsUIEnabled");
     e_154.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_154_IsEnabled);
     // e_155 element
     Grid e_155 = new Grid();
     e_154.Content = e_155;
     e_155.Name = "e_155";
     ColumnDefinition col_e_155_0 = new ColumnDefinition();
     e_155.ColumnDefinitions.Add(col_e_155_0);
     ColumnDefinition col_e_155_1 = new ColumnDefinition();
     e_155.ColumnDefinitions.Add(col_e_155_1);
     Binding binding_e_155_DataContext = new Binding("PlanetBuildingsData");
     e_155.SetBinding(Grid.DataContextProperty, binding_e_155_DataContext);
     // e_156 element
     ListBox e_156 = new ListBox();
     e_155.Children.Add(e_156);
     e_156.Name = "e_156";
     ToolTipService.SetInitialShowDelay(e_156, 0);
     Grid.SetColumn(e_156, 0);
     ScrollViewer.SetCanContentScroll(e_156, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_156, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_156, ScrollBarVisibility.Hidden);
     Binding binding_e_156_IsEnabled = new Binding("IsUIEnabled");
     e_156.SetBinding(ListBox.IsEnabledProperty, binding_e_156_IsEnabled);
     Binding binding_e_156_ItemsSource = new Binding("UnusedResourceIcons");
     e_156.SetBinding(ListBox.ItemsSourceProperty, binding_e_156_ItemsSource);
     Binding binding_e_156_SelectedIndex = new Binding("SelectedUnusedResource");
     e_156.SetBinding(ListBox.SelectedIndexProperty, binding_e_156_SelectedIndex);
     // e_157 element
     ListBox e_157 = new ListBox();
     e_155.Children.Add(e_157);
     e_157.Name = "e_157";
     ToolTipService.SetInitialShowDelay(e_157, 0);
     Grid.SetColumn(e_157, 1);
     ScrollViewer.SetCanContentScroll(e_157, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_157, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_157, ScrollBarVisibility.Hidden);
     Binding binding_e_157_IsEnabled = new Binding("IsUIEnabled");
     e_157.SetBinding(ListBox.IsEnabledProperty, binding_e_157_IsEnabled);
     Binding binding_e_157_ItemsSource = new Binding("UnusedResourceNames");
     e_157.SetBinding(ListBox.ItemsSourceProperty, binding_e_157_ItemsSource);
     Binding binding_e_157_SelectedIndex = new Binding("SelectedUnusedResource");
     e_157.SetBinding(ListBox.SelectedIndexProperty, binding_e_157_SelectedIndex);
     items.Add(tabUnusedRes);
     return items;
 }
Exemplo n.º 13
0
        public void TestScrolling()
        {
            const float elementWidth = 100;
            const float elementHeight = 200;
            const float elementDepth = 300;

            var rand = new Random();
            var scrollViewer = new ScrollViewer { ScrollMode = ScrollingMode.HorizontalVertical, Width = elementWidth, Height = elementHeight, Depth = elementDepth };
            scrollViewer.Measure(Vector3.Zero);
            scrollViewer.Arrange(Vector3.Zero, false);

            // tests that no crashes happen with no content
            scrollViewer.ScrollTo(rand.NextVector3());
            Assert.AreEqual(Vector3.Zero, ScrollPosition);
            scrollViewer.ScrollOf(rand.NextVector3());
            Assert.AreEqual(Vector3.Zero, ScrollPosition);
            scrollViewer.ScrollToBeginning(Orientation.Horizontal);
            Assert.AreEqual(Vector3.Zero, ScrollPosition);
            scrollViewer.ScrollToBeginning(Orientation.InDepth);
            Assert.AreEqual(Vector3.Zero, ScrollPosition);
            scrollViewer.ScrollToEnd(Orientation.Horizontal);
            Assert.AreEqual(Vector3.Zero, ScrollPosition);
            scrollViewer.ScrollToEnd(Orientation.InDepth);
            Assert.AreEqual(Vector3.Zero, ScrollPosition);

            // tests with an arranged element
            const float contentWidth = 1000;
            const float contentHeight = 2000;
            const float contentDepth = 3000;
            var content = new ContentDecorator { Width = contentWidth, Height = contentHeight, Depth = contentDepth };
            scrollViewer.Content = content;
            scrollViewer.Measure(Vector3.Zero);
            scrollViewer.Arrange(Vector3.Zero, false);

            var scrollValue = new Vector3(123, 456, 789);
            scrollViewer.ScrollTo(scrollValue);
            Assert.AreEqual(new Vector3(scrollValue.X, scrollValue.Y, 0), scrollViewer.ScrollPosition);

            scrollViewer.ScrollToEnd(Orientation.Horizontal);
            Assert.AreEqual(new Vector3(contentWidth - elementWidth, scrollValue.Y, 0), scrollViewer.ScrollPosition);
            scrollViewer.ScrollToEnd(Orientation.Vertical);
            Assert.AreEqual(new Vector3(contentWidth - elementWidth, contentHeight - elementHeight, 0), scrollViewer.ScrollPosition);
            scrollViewer.ScrollToEnd(Orientation.InDepth);
            Assert.AreEqual(new Vector3(contentWidth - elementWidth, contentHeight - elementHeight, 0), scrollViewer.ScrollPosition);

            scrollViewer.ScrollToBeginning(Orientation.Horizontal);
            Assert.AreEqual(new Vector3(0, contentHeight - elementHeight, 0), scrollViewer.ScrollPosition);
            scrollViewer.ScrollToBeginning(Orientation.Vertical);
            Assert.AreEqual(new Vector3(0, 0, 0), scrollViewer.ScrollPosition);
            scrollViewer.ScrollToBeginning(Orientation.InDepth);
            Assert.AreEqual(new Vector3(0, 0, 0), scrollViewer.ScrollPosition);

            scrollViewer.ScrollOf(scrollValue);
            Assert.AreEqual(new Vector3(scrollValue.X, scrollValue.Y, 0), scrollViewer.ScrollPosition);

            // tests with an not arranged element
            content.InvalidateArrange();
            scrollViewer.ScrollTo(scrollValue);
            scrollViewer.Arrange(Vector3.Zero, false);
            Assert.AreEqual(new Vector3(scrollValue.X, scrollValue.Y, 0), scrollViewer.ScrollPosition);
            content.InvalidateArrange();
            scrollViewer.ScrollOf(2*scrollValue);
            scrollViewer.ScrollTo(scrollValue);
            scrollViewer.Arrange(Vector3.Zero, false);
            Assert.AreEqual(new Vector3(scrollValue.X, scrollValue.Y, 0), scrollViewer.ScrollPosition);

            content.InvalidateArrange();
            scrollViewer.ScrollToEnd(Orientation.Horizontal);
            scrollViewer.ScrollToEnd(Orientation.Vertical);
            scrollViewer.ScrollToEnd(Orientation.InDepth);
            scrollViewer.Arrange(Vector3.Zero, false);
            Assert.AreEqual(new Vector3(contentWidth - elementWidth, contentHeight - elementHeight, 0), scrollViewer.ScrollPosition);

            content.InvalidateArrange();
            scrollViewer.ScrollToBeginning(Orientation.Horizontal);
            scrollViewer.ScrollToBeginning(Orientation.Vertical);
            scrollViewer.ScrollToBeginning(Orientation.InDepth);
            scrollViewer.Arrange(Vector3.Zero, false);
            Assert.AreEqual(new Vector3(0, 0, 0), scrollViewer.ScrollPosition);

            content.InvalidateArrange();
            scrollViewer.ScrollOf(scrollValue);
            scrollViewer.Arrange(Vector3.Zero, false);
            Assert.AreEqual(new Vector3(scrollValue.X, scrollValue.Y, 0), scrollViewer.ScrollPosition);
            content.InvalidateArrange();
            scrollViewer.ScrollToBeginning(Orientation.Horizontal);
            scrollViewer.ScrollToBeginning(Orientation.Vertical);
            scrollViewer.ScrollToBeginning(Orientation.InDepth);
            scrollViewer.ScrollOf(scrollValue);
            scrollViewer.ScrollOf(scrollValue);
            scrollViewer.Arrange(Vector3.Zero, false);
            Assert.AreEqual(new Vector3(2*scrollValue.X, 2*scrollValue.Y, 0), scrollViewer.ScrollPosition);
        }
        /// <summary>
        /// Determine whether an element is currently in the view of the
        /// ScrollViewer.
        /// </summary>
        /// <param name="viewer">The ScrollViewer.</param>
        /// <param name="element">The element.</param>
        /// <returns>
        /// A value indicating whether the element is currently in the view of
        /// the ScrollViewer.
        /// </returns>
        private static bool IsInView(ScrollViewer viewer, FrameworkElement element)
        {
            Assert.IsNotNull(viewer, "viewer should not be null!");
            Assert.IsNotNull(element, "element should not be null!");

            Rect? itemBounds = element.GetBoundsRelativeTo(viewer);
            if (itemBounds == null)
            {
                return false;
            }

            double viewBottom = viewer.ViewportHeight;
            double viewRight = viewer.ViewportWidth;

            return
                itemBounds.Value.Top >= 0 && itemBounds.Value.Top <= viewBottom &&
                itemBounds.Value.Bottom >= 0 && itemBounds.Value.Bottom <= viewBottom &&
                itemBounds.Value.Left >= 0 && itemBounds.Value.Left <= viewRight &&
                itemBounds.Value.Right >= 0 && itemBounds.Value.Right <= viewRight;
        }
Exemplo n.º 15
0
        private void CreateShipSelectionPopup()
        {
            // Create "Please select your SpaceShip" text
            var pleaseSelectText = new TextBlock
            {
                Font = westernFont,
                TextSize = 48,
                TextColor = Color.White,
                Text = "Please select your ship",
                TextAlignment = TextAlignment.Center,
                WrapText = true
            };

            // Layout elements in vertical StackPanel
            var contentStackpanel = new StackPanel { Orientation = Orientation.Vertical };

            // Create and Add SpaceShip to the stack layout
            foreach (var ship in shipList)
                contentStackpanel.Children.Add(CreateShipButtonElement(ship));

            // Uncomment those lines to have an example of stack panel item virtualization
            //var shipInitialCount = shipList.Count;
            //contentStackpanel.ItemVirtualizationEnabled = true;
            //for (int i = 0; i < 200; i++)
            //{
            //    shipList.Add(new SpaceShip { Name = shipList[i % shipInitialCount].Name });
            //    contentStackpanel.Children.Add(CreateShipButtonElement(shipList[shipList.Count - 1]));
            //}

            UpdateShipStatus();

            var contentScrollView = new ScrollViewer
            {
                MaximumHeight = 425,
                Content = contentStackpanel,
                ScrollMode = ScrollingMode.Vertical,
                Margin = new Thickness(12, 10, 7, 10),
                Padding = new Thickness(0, 0, 6, 0),
                ScrollBarColor = Color.Orange
            };

            var scrollViewerBackgroundImage = mainScreneImages["scroll_background"];
            var scrollViewerDecorator = new ContentDecorator { BackgroundImage = scrollViewerBackgroundImage, Content = contentScrollView, };
            scrollViewerDecorator.SetGridRow(2);

            var layoutGrid = new Grid();
            layoutGrid.ColumnDefinitions.Add(new StripDefinition());
            layoutGrid.RowDefinitions.Add(new StripDefinition(StripType.Auto));
            layoutGrid.RowDefinitions.Add(new StripDefinition(StripType.Fixed, 10)); // white space
            layoutGrid.RowDefinitions.Add(new StripDefinition(StripType.Star));
            layoutGrid.LayerDefinitions.Add(new StripDefinition());
            layoutGrid.Children.Add(pleaseSelectText);
            layoutGrid.Children.Add(scrollViewerDecorator);

            var shipSelectPopupContent = new ContentDecorator
            {
                BackgroundImage = popupWindowImage,
                Content = layoutGrid,
                Padding = new Thickness(110, 120, 100, 140)
            };

            // Create SpaceShip selection popup
            shipSelectPopup = new ModalElement
            {
                Visibility = Visibility.Collapsed,
                Content = shipSelectPopupContent
            };

            shipSelectPopup.SetPanelZIndex(1);
        }
Exemplo n.º 16
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var resolution = (Vector3)UIComponent.VirtualResolution;

            var canvas = new Canvas();
            var imgElt = new ImageElement { Name = "UV image", Source = new Sprite(Asset.Load<Texture>("uv")), Width = resolution.X / 5, Height = resolution.Y / 5, StretchType = StretchType.Fill };
            imgElt.DependencyProperties.Set(Canvas.PinOriginPropertyKey, 0.5f * Vector3.One);
            imgElt.DependencyProperties.Set(Canvas.AbsolutePositionPropertyKey, new Vector3(resolution.X / 10, resolution.Y / 10, 0));
            imgElt.DependencyProperties.Set(Panel.ZIndexPropertyKey, -1);

            stackPanel = new StackPanel { Orientation = Orientation.Vertical };

            scrollViewer = new ScrollViewer { ScrollMode = ScrollingMode.Vertical };
            scrollViewer.DependencyProperties.Set(Canvas.AbsolutePositionPropertyKey, new Vector3(resolution.X / 4, resolution.Y / 10, 0));
            scrollViewer.Content = stackPanel;

            var button1 = new Button { Margin = Thickness.UniformRectangle(5), Padding = Thickness.UniformRectangle(5), LocalMatrix = Matrix.Scaling(2, 2, 2) };
            var textOnly = new TextBlock { Text = "Text only button", Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15"), TextColor = new Color(1f, 0, 0, 0.5f) };
            button1.Content = textOnly;

            var button2 = new Button { Name = "Button2", Margin = Thickness.UniformRectangle(5), Padding = Thickness.UniformRectangle(5) };
            var imageContent = new ImageElement { Name = "Image Button2", Source = new Sprite(Asset.Load<Texture>("uv")), StretchType = StretchType.FillOnStretch, MaximumHeight = 50 };
            button2.Content = imageContent;

            var button3 = new Button { Margin = Thickness.UniformRectangle(5), Padding = Thickness.UniformRectangle(5) };
            var stackContent = new StackPanel { Orientation = Orientation.Horizontal };
            var stackImage = new ImageElement { Name = "Image stack panel", Source = new Sprite(Asset.Load<Texture>("uv")), MaximumHeight = 50 };
            var stackText = new TextBlock { Text = "button text", Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15"), Margin = Thickness.UniformRectangle(5) };
            stackContent.Children.Add(stackImage);
            stackContent.Children.Add(stackText);
            button3.Content = stackContent;

            var button4 = new Button { Margin = Thickness.UniformRectangle(5), HorizontalAlignment = HorizontalAlignment.Right, Padding = Thickness.UniformRectangle(5) };
            var imageContent2 = new ImageElement { Name = "button 4 uv image", Source = new Sprite(Asset.Load<Texture>("uv")), StretchType = StretchType.FillOnStretch, MaximumHeight = 40, Opacity = 0.5f };
            button4.Content = imageContent2;

            var button5 = new Button { Margin = Thickness.UniformRectangle(5), HorizontalAlignment = HorizontalAlignment.Left, Padding = Thickness.UniformRectangle(5) };
            var textOnly2 = new TextBlock { Text = "Left aligned", Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15") };
            button5.Content = textOnly2;

            var button6 = new ImageButton
            {
                Height = 50,
                Margin = Thickness.UniformRectangle(5),
                HorizontalAlignment = HorizontalAlignment.Center,
                PressedImage = new Sprite(Asset.Load<Texture>("ImageButtonPressed")),
                NotPressedImage = new Sprite(Asset.Load<Texture>("ImageButtonNotPressed")),
            };

            toggle = new ToggleButton
            {
                Content = new TextBlock { Text = "Toggle button test", Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15") },
                IsThreeState = true
            };

            scrollingText = new ScrollingText { Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15"), Text = "<<<--- Scrolling text in a button ", IsEnabled = IsUpdateAutomatic };
            var button7 = new Button { Margin = Thickness.UniformRectangle(5), Content = scrollingText };

            var uniformGrid = new UniformGrid { Rows = 2, Columns = 2 };
            var gridText = new TextBlock { Text = "Uniform grid", Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15"), TextAlignment = TextAlignment.Center};
            gridText.DependencyProperties.Set(GridBase.ColumnSpanPropertyKey, 2);
            var buttonLeft = new Button { Content = new TextBlock { Text = "unif-grid left", Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15"), TextAlignment = TextAlignment.Center } };
            buttonLeft.DependencyProperties.Set(GridBase.RowPropertyKey, 1);
            var buttonRight = new Button { Content = new TextBlock { Text = "unif-grid right", Font = Asset.Load<SpriteFont>("MicrosoftSansSerif15"), TextAlignment = TextAlignment.Center } };
            buttonRight.DependencyProperties.Set(GridBase.RowPropertyKey, 1);
            buttonRight.DependencyProperties.Set(GridBase.ColumnPropertyKey, 1);
            uniformGrid.Children.Add(gridText);
            uniformGrid.Children.Add(buttonLeft);
            uniformGrid.Children.Add(buttonRight);

            stackPanel.Children.Add(button1);
            stackPanel.Children.Add(button2);
            stackPanel.Children.Add(button3);
            stackPanel.Children.Add(button4);
            stackPanel.Children.Add(button5);
            stackPanel.Children.Add(button6);
            stackPanel.Children.Add(toggle);
            stackPanel.Children.Add(button7);
            stackPanel.Children.Add(uniformGrid);

            canvas.Children.Add(imgElt);
            canvas.Children.Add(scrollViewer);

            UIComponent.RootElement = canvas;
        }
Exemplo n.º 17
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var random = new Random(0);

            var sprites = Content.Load<SpriteSheet>("UIImages");
            var img1 = new ImageElement { Source = (SpriteFromTexture)new Sprite(Content.Load<Texture>("uv")) };
            var img2 = new ImageElement { Source = SpriteFromSheet.Create(sprites, "GameScreenLeft") };
            var img3 = new ImageElement { Source = SpriteFromSheet.Create(sprites, "GameScreenRight") };

            stackPanel1 = new StackPanel { Orientation = Orientation.Vertical, ItemVirtualizationEnabled = true };
            stackPanel1.Children.Add(img1);
            stackPanel1.Children.Add(img2);
            stackPanel1.Children.Add(img3);

            stackPanel2 = new StackPanel { Orientation = Orientation.Vertical, ItemVirtualizationEnabled = true };
            for (var i = 0; i < 1000; i++)
                stackPanel2.Children.Add(CreateButton("" + i, 75, "button number " + i));

            stackPanel3 = new StackPanel { Orientation = Orientation.Vertical, ItemVirtualizationEnabled = true, VerticalAlignment = VerticalAlignment.Center };
            for (var i = 0; i < 103; i++)
                stackPanel3.Children.Add(CreateButton("" + i, 50 + 500 * random.NextFloat(), "random button number " + i));

            stackPanel4 = new StackPanel { Orientation = Orientation.Vertical, ItemVirtualizationEnabled = true };
            for (var i = 0; i < 5; i++)
                stackPanel4.Children.Add(CreateButton("" + i, i * 30, "random button number "));

            currentStackPanel = stackPanel1;

            scrollViewer = new ScrollViewer { Name = "sv", Content = currentStackPanel, ScrollMode = ScrollingMode.Vertical };

            UIComponent.Page = new Engine.UIPage { RootElement = scrollViewer };
        }
Exemplo n.º 18
0
 /// <summary>Initializes a new instance of the <see cref="ScrolledToEndEventArgs"/> class. </summary>
 public ScrolledToEndEventArgs(ScrollViewer viewer)
 {
     ScrollViewer = viewer;
 }
Exemplo n.º 19
0
 private void InitializeComponent()
 {
     // e_0 element
     this.e_0 = new Grid();
     this.Content = this.e_0;
     this.e_0.Name = "e_0";
     this.e_0.Height = 640F;
     this.e_0.Width = 800F;
     this.e_0.HorizontalAlignment = HorizontalAlignment.Center;
     RowDefinition row_e_0_0 = new RowDefinition();
     row_e_0_0.Height = new GridLength(1F, GridUnitType.Auto);
     this.e_0.RowDefinitions.Add(row_e_0_0);
     RowDefinition row_e_0_1 = new RowDefinition();
     row_e_0_1.Height = new GridLength(1F, GridUnitType.Star);
     this.e_0.RowDefinitions.Add(row_e_0_1);
     // e_1 element
     this.e_1 = new TextBlock();
     this.e_0.Children.Add(this.e_1);
     this.e_1.Name = "e_1";
     this.e_1.Width = float.NaN;
     this.e_1.HorizontalAlignment = HorizontalAlignment.Center;
     this.e_1.VerticalAlignment = VerticalAlignment.Center;
     this.e_1.Text = "Controls";
     this.e_1.TextAlignment = TextAlignment.Center;
     this.e_1.FontSize = 40F;
     this.e_1.FontStyle = FontStyle.Bold;
     // e_2 element
     this.e_2 = new Button();
     this.e_0.Children.Add(this.e_2);
     this.e_2.Name = "e_2";
     this.e_2.Height = 80F;
     this.e_2.Width = 165F;
     this.e_2.HorizontalAlignment = HorizontalAlignment.Left;
     this.e_2.VerticalAlignment = VerticalAlignment.Center;
     this.e_2.TabIndex = 0;
     this.e_2.FontSize = 20F;
     this.e_2.FontStyle = FontStyle.Bold;
     this.e_2.Content = "Back";
     this.e_2.CommandParameter = "Options";
     Binding binding_e_2_Command = new Binding("ButtonCommand");
     this.e_2.SetBinding(Button.CommandProperty, binding_e_2_Command);
     // e_3 element
     this.e_3 = new ScrollViewer();
     this.e_0.Children.Add(this.e_3);
     this.e_3.Name = "e_3";
     Grid.SetRow(this.e_3, 1);
     // e_4 element
     this.e_4 = new TextBlock();
     this.e_3.Content = this.e_4;
     this.e_4.Name = "e_4";
     this.e_4.HorizontalAlignment = HorizontalAlignment.Center;
     this.e_4.Padding = new Thickness(20F, 20F, 20F, 20F);
     this.e_4.TextAlignment = TextAlignment.Center;
     this.e_4.FontSize = 40F;
     this.e_4.FontStyle = FontStyle.Bold;
     Binding binding_e_4_Text = new Binding("ControlsText");
     this.e_4.SetBinding(TextBlock.TextProperty, binding_e_4_Text);
     FontManager.Instance.AddFont("Segoe UI", 40F, FontStyle.Bold, "Segoe_UI_30_Bold");
     FontManager.Instance.AddFont("Segoe UI", 20F, FontStyle.Bold, "Segoe_UI_15_Bold");
 }
 public virtual void ScrollIntoViewRequiresElement()
 {
     ScrollViewer viewer = new ScrollViewer();
     viewer.ScrollIntoView(null);
 }
Exemplo n.º 21
0
 private static System.Collections.ObjectModel.ObservableCollection<object> Get_e_114_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // tabAllBuildings element
     TabItem tabAllBuildings = new TabItem();
     tabAllBuildings.Name = "tabAllBuildings";
     tabAllBuildings.Header = "All";
     // e_115 element
     ScrollViewer e_115 = new ScrollViewer();
     tabAllBuildings.Content = e_115;
     e_115.Name = "e_115";
     e_115.HorizontalAlignment = HorizontalAlignment.Stretch;
     Binding binding_e_115_IsEnabled = new Binding("IsUIEnabled");
     e_115.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_115_IsEnabled);
     // e_116 element
     Grid e_116 = new Grid();
     e_115.Content = e_116;
     e_116.Name = "e_116";
     ColumnDefinition col_e_116_0 = new ColumnDefinition();
     e_116.ColumnDefinitions.Add(col_e_116_0);
     ColumnDefinition col_e_116_1 = new ColumnDefinition();
     e_116.ColumnDefinitions.Add(col_e_116_1);
     Binding binding_e_116_DataContext = new Binding("PlanetBuildingsData");
     e_116.SetBinding(Grid.DataContextProperty, binding_e_116_DataContext);
     // e_117 element
     ListBox e_117 = new ListBox();
     e_116.Children.Add(e_117);
     e_117.Name = "e_117";
     ToolTipService.SetInitialShowDelay(e_117, 0);
     Grid.SetColumn(e_117, 0);
     ScrollViewer.SetCanContentScroll(e_117, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_117, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_117, ScrollBarVisibility.Hidden);
     Binding binding_e_117_IsEnabled = new Binding("IsUIEnabled");
     e_117.SetBinding(ListBox.IsEnabledProperty, binding_e_117_IsEnabled);
     Binding binding_e_117_ItemsSource = new Binding("BuildingIcons");
     e_117.SetBinding(ListBox.ItemsSourceProperty, binding_e_117_ItemsSource);
     Binding binding_e_117_SelectedIndex = new Binding("SelectedBuilding");
     e_117.SetBinding(ListBox.SelectedIndexProperty, binding_e_117_SelectedIndex);
     // e_118 element
     ListBox e_118 = new ListBox();
     e_116.Children.Add(e_118);
     e_118.Name = "e_118";
     ToolTipService.SetInitialShowDelay(e_118, 0);
     Grid.SetColumn(e_118, 1);
     ScrollViewer.SetCanContentScroll(e_118, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_118, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_118, ScrollBarVisibility.Hidden);
     Binding binding_e_118_IsEnabled = new Binding("IsUIEnabled");
     e_118.SetBinding(ListBox.IsEnabledProperty, binding_e_118_IsEnabled);
     Binding binding_e_118_ItemsSource = new Binding("BuildingNames");
     e_118.SetBinding(ListBox.ItemsSourceProperty, binding_e_118_ItemsSource);
     Binding binding_e_118_SelectedIndex = new Binding("SelectedBuilding");
     e_118.SetBinding(ListBox.SelectedIndexProperty, binding_e_118_SelectedIndex);
     items.Add(tabAllBuildings);
     // tabResourceBuildings element
     TabItem tabResourceBuildings = new TabItem();
     tabResourceBuildings.Name = "tabResourceBuildings";
     tabResourceBuildings.Header = "Resources";
     // e_119 element
     ScrollViewer e_119 = new ScrollViewer();
     tabResourceBuildings.Content = e_119;
     e_119.Name = "e_119";
     e_119.Width = 490F;
     e_119.HorizontalAlignment = HorizontalAlignment.Stretch;
     Binding binding_e_119_IsEnabled = new Binding("IsUIEnabled");
     e_119.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_119_IsEnabled);
     // e_120 element
     Grid e_120 = new Grid();
     e_119.Content = e_120;
     e_120.Name = "e_120";
     ColumnDefinition col_e_120_0 = new ColumnDefinition();
     col_e_120_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_120.ColumnDefinitions.Add(col_e_120_0);
     ColumnDefinition col_e_120_1 = new ColumnDefinition();
     col_e_120_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_120.ColumnDefinitions.Add(col_e_120_1);
     Binding binding_e_120_DataContext = new Binding("PlanetBuildingsData");
     e_120.SetBinding(Grid.DataContextProperty, binding_e_120_DataContext);
     // e_121 element
     ListBox e_121 = new ListBox();
     e_120.Children.Add(e_121);
     e_121.Name = "e_121";
     ToolTipService.SetInitialShowDelay(e_121, 0);
     Grid.SetColumn(e_121, 0);
     ScrollViewer.SetCanContentScroll(e_121, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_121, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_121, ScrollBarVisibility.Hidden);
     Binding binding_e_121_IsEnabled = new Binding("IsUIEnabled");
     e_121.SetBinding(ListBox.IsEnabledProperty, binding_e_121_IsEnabled);
     Binding binding_e_121_ItemsSource = new Binding("ResourcesBuildingIcons");
     e_121.SetBinding(ListBox.ItemsSourceProperty, binding_e_121_ItemsSource);
     Binding binding_e_121_SelectedIndex = new Binding("ResourcesSelectedBuilding");
     e_121.SetBinding(ListBox.SelectedIndexProperty, binding_e_121_SelectedIndex);
     // e_122 element
     ListBox e_122 = new ListBox();
     e_120.Children.Add(e_122);
     e_122.Name = "e_122";
     ToolTipService.SetInitialShowDelay(e_122, 0);
     Grid.SetColumn(e_122, 1);
     ScrollViewer.SetCanContentScroll(e_122, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_122, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_122, ScrollBarVisibility.Hidden);
     Binding binding_e_122_IsEnabled = new Binding("IsUIEnabled");
     e_122.SetBinding(ListBox.IsEnabledProperty, binding_e_122_IsEnabled);
     Binding binding_e_122_ItemsSource = new Binding("ResourcesBuildingNames");
     e_122.SetBinding(ListBox.ItemsSourceProperty, binding_e_122_ItemsSource);
     Binding binding_e_122_SelectedIndex = new Binding("ResourcesSelectedBuilding");
     e_122.SetBinding(ListBox.SelectedIndexProperty, binding_e_122_SelectedIndex);
     items.Add(tabResourceBuildings);
     // tabProductionBuildings element
     TabItem tabProductionBuildings = new TabItem();
     tabProductionBuildings.Name = "tabProductionBuildings";
     tabProductionBuildings.Header = "Production";
     // e_123 element
     ScrollViewer e_123 = new ScrollViewer();
     tabProductionBuildings.Content = e_123;
     e_123.Name = "e_123";
     e_123.Width = 490F;
     e_123.HorizontalAlignment = HorizontalAlignment.Stretch;
     Binding binding_e_123_IsEnabled = new Binding("IsUIEnabled");
     e_123.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_123_IsEnabled);
     // e_124 element
     Grid e_124 = new Grid();
     e_123.Content = e_124;
     e_124.Name = "e_124";
     ColumnDefinition col_e_124_0 = new ColumnDefinition();
     col_e_124_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_124.ColumnDefinitions.Add(col_e_124_0);
     ColumnDefinition col_e_124_1 = new ColumnDefinition();
     col_e_124_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_124.ColumnDefinitions.Add(col_e_124_1);
     Binding binding_e_124_DataContext = new Binding("PlanetBuildingsData");
     e_124.SetBinding(Grid.DataContextProperty, binding_e_124_DataContext);
     // e_125 element
     ListBox e_125 = new ListBox();
     e_124.Children.Add(e_125);
     e_125.Name = "e_125";
     e_125.Background = new SolidColorBrush(new ColorW(255, 255, 255, 0));
     ToolTipService.SetInitialShowDelay(e_125, 0);
     Grid.SetColumn(e_125, 0);
     ScrollViewer.SetCanContentScroll(e_125, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_125, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_125, ScrollBarVisibility.Hidden);
     Binding binding_e_125_IsEnabled = new Binding("IsUIEnabled");
     e_125.SetBinding(ListBox.IsEnabledProperty, binding_e_125_IsEnabled);
     Binding binding_e_125_ItemsSource = new Binding("ProductionBuildingIcons");
     e_125.SetBinding(ListBox.ItemsSourceProperty, binding_e_125_ItemsSource);
     Binding binding_e_125_SelectedIndex = new Binding("ProductionSelectedBuilding");
     e_125.SetBinding(ListBox.SelectedIndexProperty, binding_e_125_SelectedIndex);
     // e_126 element
     ListBox e_126 = new ListBox();
     e_124.Children.Add(e_126);
     e_126.Name = "e_126";
     ToolTipService.SetInitialShowDelay(e_126, 0);
     Grid.SetColumn(e_126, 1);
     ScrollViewer.SetCanContentScroll(e_126, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_126, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_126, ScrollBarVisibility.Hidden);
     Binding binding_e_126_IsEnabled = new Binding("IsUIEnabled");
     e_126.SetBinding(ListBox.IsEnabledProperty, binding_e_126_IsEnabled);
     Binding binding_e_126_ItemsSource = new Binding("ProductionBuildingNames");
     e_126.SetBinding(ListBox.ItemsSourceProperty, binding_e_126_ItemsSource);
     Binding binding_e_126_SelectedIndex = new Binding("ProductionSelectedBuilding");
     e_126.SetBinding(ListBox.SelectedIndexProperty, binding_e_126_SelectedIndex);
     items.Add(tabProductionBuildings);
     // tabResearchBuildings element
     TabItem tabResearchBuildings = new TabItem();
     tabResearchBuildings.Name = "tabResearchBuildings";
     tabResearchBuildings.Header = "Research";
     // e_127 element
     ScrollViewer e_127 = new ScrollViewer();
     tabResearchBuildings.Content = e_127;
     e_127.Name = "e_127";
     e_127.Width = 490F;
     e_127.HorizontalAlignment = HorizontalAlignment.Stretch;
     Binding binding_e_127_IsEnabled = new Binding("IsUIEnabled");
     e_127.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_127_IsEnabled);
     // e_128 element
     Grid e_128 = new Grid();
     e_127.Content = e_128;
     e_128.Name = "e_128";
     ColumnDefinition col_e_128_0 = new ColumnDefinition();
     col_e_128_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_128.ColumnDefinitions.Add(col_e_128_0);
     ColumnDefinition col_e_128_1 = new ColumnDefinition();
     col_e_128_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_128.ColumnDefinitions.Add(col_e_128_1);
     Binding binding_e_128_DataContext = new Binding("PlanetBuildingsData");
     e_128.SetBinding(Grid.DataContextProperty, binding_e_128_DataContext);
     // e_129 element
     ListBox e_129 = new ListBox();
     e_128.Children.Add(e_129);
     e_129.Name = "e_129";
     e_129.Background = new SolidColorBrush(new ColorW(255, 255, 255, 0));
     ToolTipService.SetInitialShowDelay(e_129, 0);
     Grid.SetColumn(e_129, 0);
     ScrollViewer.SetCanContentScroll(e_129, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_129, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_129, ScrollBarVisibility.Hidden);
     Binding binding_e_129_IsEnabled = new Binding("IsUIEnabled");
     e_129.SetBinding(ListBox.IsEnabledProperty, binding_e_129_IsEnabled);
     Binding binding_e_129_ItemsSource = new Binding("ResearchBuildingIcons");
     e_129.SetBinding(ListBox.ItemsSourceProperty, binding_e_129_ItemsSource);
     Binding binding_e_129_SelectedIndex = new Binding("ResearchSelectedBuilding");
     e_129.SetBinding(ListBox.SelectedIndexProperty, binding_e_129_SelectedIndex);
     // e_130 element
     ListBox e_130 = new ListBox();
     e_128.Children.Add(e_130);
     e_130.Name = "e_130";
     ToolTipService.SetInitialShowDelay(e_130, 0);
     Grid.SetColumn(e_130, 1);
     ScrollViewer.SetCanContentScroll(e_130, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_130, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_130, ScrollBarVisibility.Hidden);
     Binding binding_e_130_IsEnabled = new Binding("IsUIEnabled");
     e_130.SetBinding(ListBox.IsEnabledProperty, binding_e_130_IsEnabled);
     Binding binding_e_130_ItemsSource = new Binding("ResearchBuildingNames");
     e_130.SetBinding(ListBox.ItemsSourceProperty, binding_e_130_ItemsSource);
     Binding binding_e_130_SelectedIndex = new Binding("ResearchSelectedBuilding");
     e_130.SetBinding(ListBox.SelectedIndexProperty, binding_e_130_SelectedIndex);
     items.Add(tabResearchBuildings);
     // tabMilitaryBuildings element
     TabItem tabMilitaryBuildings = new TabItem();
     tabMilitaryBuildings.Name = "tabMilitaryBuildings";
     tabMilitaryBuildings.Header = "Military";
     // e_131 element
     ScrollViewer e_131 = new ScrollViewer();
     tabMilitaryBuildings.Content = e_131;
     e_131.Name = "e_131";
     e_131.Width = 490F;
     e_131.HorizontalAlignment = HorizontalAlignment.Stretch;
     Binding binding_e_131_IsEnabled = new Binding("IsUIEnabled");
     e_131.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_131_IsEnabled);
     // e_132 element
     Grid e_132 = new Grid();
     e_131.Content = e_132;
     e_132.Name = "e_132";
     ColumnDefinition col_e_132_0 = new ColumnDefinition();
     col_e_132_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_132.ColumnDefinitions.Add(col_e_132_0);
     ColumnDefinition col_e_132_1 = new ColumnDefinition();
     col_e_132_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_132.ColumnDefinitions.Add(col_e_132_1);
     Binding binding_e_132_DataContext = new Binding("PlanetBuildingsData");
     e_132.SetBinding(Grid.DataContextProperty, binding_e_132_DataContext);
     // e_133 element
     ListBox e_133 = new ListBox();
     e_132.Children.Add(e_133);
     e_133.Name = "e_133";
     e_133.Background = new SolidColorBrush(new ColorW(255, 255, 255, 0));
     ToolTipService.SetInitialShowDelay(e_133, 0);
     Grid.SetColumn(e_133, 0);
     ScrollViewer.SetCanContentScroll(e_133, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_133, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_133, ScrollBarVisibility.Hidden);
     Binding binding_e_133_IsEnabled = new Binding("IsUIEnabled");
     e_133.SetBinding(ListBox.IsEnabledProperty, binding_e_133_IsEnabled);
     Binding binding_e_133_ItemsSource = new Binding("MilitaryBuildingIcons");
     e_133.SetBinding(ListBox.ItemsSourceProperty, binding_e_133_ItemsSource);
     Binding binding_e_133_SelectedIndex = new Binding("MilitarySelectedBuilding");
     e_133.SetBinding(ListBox.SelectedIndexProperty, binding_e_133_SelectedIndex);
     // e_134 element
     ListBox e_134 = new ListBox();
     e_132.Children.Add(e_134);
     e_134.Name = "e_134";
     ToolTipService.SetInitialShowDelay(e_134, 0);
     Grid.SetColumn(e_134, 1);
     ScrollViewer.SetCanContentScroll(e_134, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_134, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_134, ScrollBarVisibility.Hidden);
     Binding binding_e_134_IsEnabled = new Binding("IsUIEnabled");
     e_134.SetBinding(ListBox.IsEnabledProperty, binding_e_134_IsEnabled);
     Binding binding_e_134_ItemsSource = new Binding("MilitaryBuildingNames");
     e_134.SetBinding(ListBox.ItemsSourceProperty, binding_e_134_ItemsSource);
     Binding binding_e_134_SelectedIndex = new Binding("MilitarySelectedBuilding");
     e_134.SetBinding(ListBox.SelectedIndexProperty, binding_e_134_SelectedIndex);
     items.Add(tabMilitaryBuildings);
     // tabMilitaryBuildings1 element
     TabItem tabMilitaryBuildings1 = new TabItem();
     tabMilitaryBuildings1.Name = "tabMilitaryBuildings1";
     tabMilitaryBuildings1.Header = "Military";
     // e_135 element
     ScrollViewer e_135 = new ScrollViewer();
     tabMilitaryBuildings1.Content = e_135;
     e_135.Name = "e_135";
     e_135.Width = 490F;
     e_135.HorizontalAlignment = HorizontalAlignment.Stretch;
     Binding binding_e_135_IsEnabled = new Binding("IsUIEnabled");
     e_135.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_135_IsEnabled);
     // e_136 element
     Grid e_136 = new Grid();
     e_135.Content = e_136;
     e_136.Name = "e_136";
     ColumnDefinition col_e_136_0 = new ColumnDefinition();
     col_e_136_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_136.ColumnDefinitions.Add(col_e_136_0);
     ColumnDefinition col_e_136_1 = new ColumnDefinition();
     col_e_136_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_136.ColumnDefinitions.Add(col_e_136_1);
     Binding binding_e_136_DataContext = new Binding("PlanetBuildingsData");
     e_136.SetBinding(Grid.DataContextProperty, binding_e_136_DataContext);
     // e_137 element
     ListBox e_137 = new ListBox();
     e_136.Children.Add(e_137);
     e_137.Name = "e_137";
     e_137.Background = new SolidColorBrush(new ColorW(255, 255, 255, 0));
     ToolTipService.SetInitialShowDelay(e_137, 0);
     Grid.SetColumn(e_137, 0);
     ScrollViewer.SetCanContentScroll(e_137, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_137, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_137, ScrollBarVisibility.Hidden);
     Binding binding_e_137_IsEnabled = new Binding("IsUIEnabled");
     e_137.SetBinding(ListBox.IsEnabledProperty, binding_e_137_IsEnabled);
     Binding binding_e_137_ItemsSource = new Binding("MilitaryBuildingIcons");
     e_137.SetBinding(ListBox.ItemsSourceProperty, binding_e_137_ItemsSource);
     Binding binding_e_137_SelectedIndex = new Binding("MilitarySelectedBuilding");
     e_137.SetBinding(ListBox.SelectedIndexProperty, binding_e_137_SelectedIndex);
     // e_138 element
     ListBox e_138 = new ListBox();
     e_136.Children.Add(e_138);
     e_138.Name = "e_138";
     ToolTipService.SetInitialShowDelay(e_138, 0);
     Grid.SetColumn(e_138, 1);
     ScrollViewer.SetCanContentScroll(e_138, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_138, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_138, ScrollBarVisibility.Hidden);
     Binding binding_e_138_IsEnabled = new Binding("IsUIEnabled");
     e_138.SetBinding(ListBox.IsEnabledProperty, binding_e_138_IsEnabled);
     Binding binding_e_138_ItemsSource = new Binding("MilitaryBuildingNames");
     e_138.SetBinding(ListBox.ItemsSourceProperty, binding_e_138_ItemsSource);
     Binding binding_e_138_SelectedIndex = new Binding("MilitarySelectedBuilding");
     e_138.SetBinding(ListBox.SelectedIndexProperty, binding_e_138_SelectedIndex);
     items.Add(tabMilitaryBuildings1);
     // tabMilitaryBuildings2 element
     TabItem tabMilitaryBuildings2 = new TabItem();
     tabMilitaryBuildings2.Name = "tabMilitaryBuildings2";
     tabMilitaryBuildings2.Header = "Military";
     // e_139 element
     ScrollViewer e_139 = new ScrollViewer();
     tabMilitaryBuildings2.Content = e_139;
     e_139.Name = "e_139";
     e_139.HorizontalAlignment = HorizontalAlignment.Stretch;
     Binding binding_e_139_IsEnabled = new Binding("IsUIEnabled");
     e_139.SetBinding(ScrollViewer.IsEnabledProperty, binding_e_139_IsEnabled);
     // e_140 element
     Grid e_140 = new Grid();
     e_139.Content = e_140;
     e_140.Name = "e_140";
     ColumnDefinition col_e_140_0 = new ColumnDefinition();
     col_e_140_0.Width = new GridLength(1F, GridUnitType.Auto);
     e_140.ColumnDefinitions.Add(col_e_140_0);
     ColumnDefinition col_e_140_1 = new ColumnDefinition();
     col_e_140_1.Width = new GridLength(1F, GridUnitType.Auto);
     e_140.ColumnDefinitions.Add(col_e_140_1);
     Binding binding_e_140_DataContext = new Binding("PlanetBuildingsData");
     e_140.SetBinding(Grid.DataContextProperty, binding_e_140_DataContext);
     // e_141 element
     ListBox e_141 = new ListBox();
     e_140.Children.Add(e_141);
     e_141.Name = "e_141";
     e_141.Background = new SolidColorBrush(new ColorW(255, 255, 255, 0));
     ToolTipService.SetInitialShowDelay(e_141, 0);
     Grid.SetColumn(e_141, 0);
     ScrollViewer.SetCanContentScroll(e_141, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_141, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_141, ScrollBarVisibility.Hidden);
     Binding binding_e_141_IsEnabled = new Binding("IsUIEnabled");
     e_141.SetBinding(ListBox.IsEnabledProperty, binding_e_141_IsEnabled);
     Binding binding_e_141_ItemsSource = new Binding("MilitaryBuildingIcons");
     e_141.SetBinding(ListBox.ItemsSourceProperty, binding_e_141_ItemsSource);
     Binding binding_e_141_SelectedIndex = new Binding("MilitarySelectedBuilding");
     e_141.SetBinding(ListBox.SelectedIndexProperty, binding_e_141_SelectedIndex);
     // e_142 element
     ListBox e_142 = new ListBox();
     e_140.Children.Add(e_142);
     e_142.Name = "e_142";
     ToolTipService.SetInitialShowDelay(e_142, 0);
     Grid.SetColumn(e_142, 1);
     ScrollViewer.SetCanContentScroll(e_142, false);
     ScrollViewer.SetHorizontalScrollBarVisibility(e_142, ScrollBarVisibility.Hidden);
     ScrollViewer.SetVerticalScrollBarVisibility(e_142, ScrollBarVisibility.Hidden);
     Binding binding_e_142_IsEnabled = new Binding("IsUIEnabled");
     e_142.SetBinding(ListBox.IsEnabledProperty, binding_e_142_IsEnabled);
     Binding binding_e_142_ItemsSource = new Binding("MilitaryBuildingNames");
     e_142.SetBinding(ListBox.ItemsSourceProperty, binding_e_142_ItemsSource);
     Binding binding_e_142_SelectedIndex = new Binding("MilitarySelectedBuilding");
     e_142.SetBinding(ListBox.SelectedIndexProperty, binding_e_142_SelectedIndex);
     items.Add(tabMilitaryBuildings2);
     return items;
 }