protected override async Task LoadContent()
        {
            await base.LoadContent();

            UIComponent.VirtualResolution = new Vector3(GraphicsDevice.BackBuffer.Width, GraphicsDevice.BackBuffer.Height, 500);
            
            textBlock = new TextBlock
            {
                WrapText = true,
                TextSize = 15,
                TextColor = Color.Black,
                Font = Asset.Load<SpriteFont>("MSMincho10"),
                Text = @"This is a very long sentence that will hopefully be wrapped up. 
Does it work with kanjis too? let's see that in the following line. Here we goes.
漢字も大丈夫そうですね!良かった!でも、文章の切る所は本当に合ってますか?どうかな。。
やった!",
                SynchronousCharacterGeneration = true,
            };
            var decorator = new ContentDecorator
            {
                Width = 200,
                Content = textBlock, 
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                BackgroundImage = new UIImage(Asset.Load<Texture>("DumbWhite"))
            };

            UIComponent.RootElement = decorator;
        }
        protected override async Task LoadContent()
        {
            await base.LoadContent();


            textScroller = new ScrollingText
            {
                Name = "Text Scroller", 
                DesiredCharacterNumber = 25, 
                Text = InitialText,
                TextColor = Color.Black,
                Font = Asset.Load<SpriteFont>("CourierNew12"), 
                IsEnabled = IsAutomatic,
                SynchronousCharacterGeneration = true
            };
            
            decorator = new ContentDecorator
            {
                Name = "ContentDecorator", 
                Content = textScroller, 
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                BackgroundImage = new UIImage(Asset.Load<Texture>("DumbWhite"))
            };

            UIComponent.RootElement = decorator;
        }
        protected override async Task LoadContent()
        {
            await base.LoadContent();
            
            textBlock = new TextBlock
            {
                TextColor = Color.Black,
                Font = Asset.Load<SpriteFont>("MSMincho10"),
                Text = @"Simple sample text surrounded by decorator.",
                SynchronousCharacterGeneration = true
            };

            var decorator = new ContentDecorator
            {
                Content = textBlock, 
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                BackgroundImage = new Sprite(Asset.Load<Texture>("DumbWhite"))
            };

            UIComponent.RootElement = decorator;
        }
Beispiel #4
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var uiGroup = Asset.Load<SpriteSheet>("UIImages");

            element4 = new ContentDecorator
            {
                Name = "4", 
                Width = 200, 
                Height = 100, 
                LocalMatrix = Matrix.Translation(-50, -50, 0),
                BackgroundImage = uiGroup["uvNotRotated"],
            };

            element3 = new ContentDecorator
            {
                Name = "3", 
                Width = 300,
                Height = 150,
                Content = element4,
                LocalMatrix = Matrix.Translation(-200, -100, 0),
                BackgroundImage = uiGroup["uvRotated90"],
            };

            var borderImage = uiGroup["BorderButton"];
            element2 = new ContentDecorator { Name = "2", Width = 600, Height = 300, Content = element3, BackgroundImage = borderImage };
            element2.DependencyProperties.Set(Canvas.AbsolutePositionPropertyKey, new Vector3(400, 200, 0));
            element2.DependencyProperties.Set(Panel.ZIndexPropertyKey, 1);

            element1 = new ContentDecorator { Name = "1", Width = 600, Height = 300, BackgroundImage = uiGroup["GameScreen"] };

            var canvas = new Canvas();
            canvas.Children.Add(element1);
            canvas.Children.Add(element2);

            UIComponent.RootElement = canvas;
        }
Beispiel #5
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var uiImages = Asset.Load<UIImageGroup>("UIImages");

            var img1 = new ImageElement { Name = "UV 1 stack panel", Source = new UIImage(Asset.Load<Texture>("uv")) };
            var img2 = new ImageElement { Name = "UV 2 stack panel", Source = new UIImage(Asset.Load<Texture>("uv")) };
            img3 = new ImageElement { Name = "UV 3 stack panel", Source = new UIImage(Asset.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 = new UIImage(Asset.Load<Texture>("uv")) };
            var img5 = new ImageElement { Name = "UV grid 2", Source = new UIImage(Asset.Load<Texture>("uv")) };
            var img6 = new ImageElement { Name = "Game screen grid", Source = uiImages["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.RootElement = contentDecorator;
        }
Beispiel #6
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            textBlock = new TextBlock
                {
                    Font = Asset.Load<SpriteFont>("MSMincho10"), 
                    Text = "Simple Text - 簡単な文章。", 
                    TextColor = Color.Black,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Center,
                    SynchronousCharacterGeneration = true
                };

            decorator = new ContentDecorator
            {
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                BackgroundImage = new UIImage(Asset.Load<Texture>("DumbWhite")),
                Content = textBlock
            };

            UIComponent.RootElement = decorator;
        }
Beispiel #7
0
        private void CreateGameUI()
        {
            distanceTextBlock = new TextBlock { Font = spriteFont, TextColor = Color.Gold, VerticalAlignment = VerticalAlignment.Center };
            distanceTextBlock.SetCanvasPinOrigin(new Vector3(0.5f, 0.5f, 1f));
            distanceTextBlock.SetCanvasRelativePosition(new Vector3(0.2f, 0.05f, 0f));

            var scoreBoard = new ContentDecorator
            {
                BackgroundImage = uiImages["distance_bg"],
                Content = distanceTextBlock,
                Padding = new Thickness(60, 31, 25, 35),
                MinimumWidth = 290f // Set the minimum width of score button so that it wont modify when the content (text) changes, and less than minimum.
            };

            gameRoot = new Canvas();
            gameRoot.Children.Add(scoreBoard);
        }
        private UIElement CreateMainSceneShipStatusStars(string imageName, UIElement content, int rowIndex)
        {
            var item = new ContentDecorator
            {
                Content = content,
                BackgroundImage = mainScreneImages[imageName],
                HorizontalAlignment = HorizontalAlignment.Center
            };
            item.SetGridRow(rowIndex);

            return item;
        }
        private UIElement CreateMainScene()
        {
            // the top life bar
            var topBar = CreateMainScreneTopBar();

            // Create Name label
            nameTextBlock = new TextBlock
            {
                Font = westernFont,
                TextSize = 52,
                TextColor = Color.LightGreen,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                Margin = new Thickness(50, 0, 50, 0)
            };
            var nameLabel = new ContentDecorator
            {
                BackgroundImage = mainScreneImages["tex_edit_inactivated_background"],
                Content = nameTextBlock,
                Padding = new Thickness(20, 15, 20, 20),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center
            };
            nameLabel.SetGridRow(1);

            // Create Character image
            var characterImage = new ImageElement
            {
                Name = "HeroImage",
                Source = mainScreneImages["character"],
                HorizontalAlignment = HorizontalAlignment.Center,
            };
            characterImage.SetGridRow(2);

            // Create Explanation TextBlock
            var explanationLabel = new ContentDecorator
            {
                BackgroundImage = mainScreneImages["description_frame"],
                HorizontalAlignment = HorizontalAlignment.Center,
                Content = new TextBlock
                {
                    Font = LoadAsset<SpriteFont>("JapaneseFont"),
                    TextSize = 34,
                    TextColor = Color.White,
                    Text = "Pictogram-based alphabets are easily supported.\n日本語も簡単に入れることが出来ます。",
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Center,
                    WrapText = true
                },
                Padding = new Thickness(50, 30, 50, 40),
            };
            explanationLabel.SetGridRow(3);

            // The ship status panel
            var shipStatusPanel = CreateMainSceneShipStatusPanel();
            shipStatusPanel.SetGridRow(4);

            // Create quit button (Last element)
            var quitButton = CreateTextButton("Quit Sample");
            quitButton.HorizontalAlignment = HorizontalAlignment.Center;
            quitButton.VerticalAlignment = VerticalAlignment.Center;
            quitButton.Click += delegate { UIGame.Exit(); };
            quitButton.SetGridRow(5);

            // Put region together in the main grid
            var mainLayout = new Grid();
            mainLayout.ColumnDefinitions.Add(new StripDefinition());
            mainLayout.RowDefinitions.Add(new StripDefinition(StripType.Star, 15));
            mainLayout.RowDefinitions.Add(new StripDefinition(StripType.Star, 10));
            mainLayout.RowDefinitions.Add(new StripDefinition(StripType.Star, 20));
            mainLayout.RowDefinitions.Add(new StripDefinition(StripType.Star, 20));
            mainLayout.RowDefinitions.Add(new StripDefinition(StripType.Star, 25));
            mainLayout.RowDefinitions.Add(new StripDefinition(StripType.Star, 10));
            mainLayout.LayerDefinitions.Add(new StripDefinition());

            // set minimal and maximal size of rows
            mainLayout.RowDefinitions[0].MaximumSize = topBar.MaximumHeight;
            mainLayout.RowDefinitions[1].MinimumSize = 100;
            mainLayout.RowDefinitions[3].MinimumSize = 120;
            mainLayout.RowDefinitions[5].MinimumSize = 90;

            mainLayout.Children.Add(topBar);
            mainLayout.Children.Add(nameLabel);
            mainLayout.Children.Add(characterImage);
            mainLayout.Children.Add(explanationLabel);
            mainLayout.Children.Add(shipStatusPanel);
            mainLayout.Children.Add(quitButton);


            return mainLayout;
        }
Beispiel #10
0
        private void CreateWelcomePopup()
        {
            // Create welcome text
            var welcomeText = new TextBlock
            {
                Font = westernFont,
                TextSize = 42,
                TextColor = Color.White,
                Text = "Welcome to paradox UI sample.\n" + "Please name your character",
                TextAlignment = TextAlignment.Center,
                WrapText = true,
                Margin = new Thickness(20, 0, 20, 0),
                HorizontalAlignment = HorizontalAlignment.Center
            };

            // Create Edit text
            var nameEditText = new EditText(Services)
            {
                Font = westernFont,
                TextSize = 32,
                TextColor = Color.White,
                Text = DefaultName,
                MaxLength = 15,
                TextAlignment = TextAlignment.Center,
                ActiveImage = mainScreneImages["tex_edit_activated_background"],
                InactiveImage = mainScreneImages["tex_edit_inactivated_background"],
                MouseOverImage = mainScreneImages["tex_edit_inactivated_background"],
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                MinimumWidth = 340,
                Padding = new Thickness(30, 30, 30, 40), // Pad text (Content inside),
                Margin = new Thickness(0, 80, 0, 80), // Space around the edit
            };
            nameEditText.SetGridRow(1);

            // Create cancel and validate button
            var cancelButton = CreateTextButton("Cancel");
            cancelButton.SetGridColumn(1);

            cancelButton.Click += delegate
            {
                nameTextBlock.Text = DefaultName;
                welcomePopup.Visibility = Visibility.Collapsed;
            };

            var validateButton = CreateTextButton("Validate");
            validateButton.SetGridColumn(3);

            validateButton.Click += delegate
            {
                nameTextBlock.Text = nameEditText.Text.Trim();
                welcomePopup.Visibility = Visibility.Collapsed;
            };

            // Put cancel and validate buttons in stack panel (Left-right orientation placement)
            var buttonPanel = new Grid();
            buttonPanel.ColumnDefinitions.Add(new StripDefinition(StripType.Star));
            buttonPanel.ColumnDefinitions.Add(new StripDefinition(StripType.Auto));
            buttonPanel.ColumnDefinitions.Add(new StripDefinition(StripType.Star));
            buttonPanel.ColumnDefinitions.Add(new StripDefinition(StripType.Auto));
            buttonPanel.ColumnDefinitions.Add(new StripDefinition(StripType.Star));
            buttonPanel.RowDefinitions.Add(new StripDefinition());
            buttonPanel.LayerDefinitions.Add(new StripDefinition());

            buttonPanel.Children.Add(cancelButton);
            buttonPanel.Children.Add(validateButton);
            buttonPanel.SetGridRow(2);

            // Create a stack panel to store items (Top-down orientation placement)
            var popupContentPanel = new Grid
            {
                MaximumWidth = 580,
                MaximumHeight = 900,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
            };

            popupContentPanel.ColumnDefinitions.Add(new StripDefinition());
            popupContentPanel.RowDefinitions.Add(new StripDefinition(StripType.Auto));
            popupContentPanel.RowDefinitions.Add(new StripDefinition(StripType.Star));
            popupContentPanel.RowDefinitions.Add(new StripDefinition(StripType.Auto));
            popupContentPanel.LayerDefinitions.Add(new StripDefinition());

            popupContentPanel.Children.Add(welcomeText);
            popupContentPanel.Children.Add(nameEditText);
            popupContentPanel.Children.Add(buttonPanel);

            var welcomePopupContent = new ContentDecorator
            {
                BackgroundImage = popupWindowImage,
                Content = popupContentPanel,
                Padding = new Thickness(85, 130, 85, 110)
            };

            welcomePopup = new ModalElement
            {
                Visibility = Visibility.Collapsed,
                Content = welcomePopupContent,
            };
            welcomePopup.SetPanelZIndex(1);
        }
Beispiel #11
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);
        }
        protected override void LoadScene()
        {
            // Allow user to resize the window with the mouse.
            Game.Window.AllowUserResizing = true;

            var arial = LoadAsset<SpriteFont>("WesternFont");
            var uiImages = LoadAsset<SpriteSheet>("SplashScreenImages");

            // Create and initialize "Paradox Samples" Text
            var paradoxSampleTextBlock = new ContentDecorator
            {
                BackgroundImage = uiImages["paradox_sample_text_bg"],
                Content = new TextBlock
                {
                    Font = arial,
                    TextSize = 60,
                    Text = "Paradox Samples",
                    TextColor = Color.White,
                },
                Padding = new Thickness(35, 15, 35, 25),
                HorizontalAlignment = HorizontalAlignment.Center
            };

            paradoxSampleTextBlock.SetPanelZIndex(1);

            // Create and initialize "UI" Text
            var uiTextBlock = new ContentDecorator
            {
                BackgroundImage = uiImages["ui_text_bg"],
                Content = new TextBlock
                {
                    Font = arial,
                    TextSize = 60,
                    Text = "UI",
                    TextColor = Color.White,
                },
                Padding = new Thickness(15, 4, 15, 7),
                HorizontalAlignment = HorizontalAlignment.Center
            };

            uiTextBlock.SetPanelZIndex(1);
            uiTextBlock.SetGridRow(1);

            // Create and initialize Paradox Logo
            var paradoxLogoImageElement = new ImageElement
            {
                Source = uiImages["Logo"],
                HorizontalAlignment = HorizontalAlignment.Center
            };

            paradoxLogoImageElement.SetPanelZIndex(1);
            paradoxLogoImageElement.SetGridRow(3);

            // Create and initialize "Touch Screen to Start"
            var touchStartLabel = new ContentDecorator
            {
                BackgroundImage = uiImages["touch_start_frame"],
                Content = new TextBlock
                {
                    Font = arial,
                    TextSize = 42,
                    Text = "Touch Screen to Start",
                    TextColor = Color.White
                },
                Padding = new Thickness(30, 20, 30, 25),
                HorizontalAlignment = HorizontalAlignment.Center
            };

            touchStartLabel.SetPanelZIndex(1);
            touchStartLabel.SetGridRow(5);

            var grid = new Grid
            {
                MaximumWidth = 600,
                MaximumHeight = 900,
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
            };

            grid.RowDefinitions.Add(new StripDefinition(StripType.Auto));
            grid.RowDefinitions.Add(new StripDefinition(StripType.Auto));
            grid.RowDefinitions.Add(new StripDefinition(StripType.Star, 2));
            grid.RowDefinitions.Add(new StripDefinition(StripType.Star, 5));
            grid.RowDefinitions.Add(new StripDefinition(StripType.Star, 2));
            grid.RowDefinitions.Add(new StripDefinition(StripType.Auto));
            grid.ColumnDefinitions.Add(new StripDefinition());
            grid.LayerDefinitions.Add(new StripDefinition());

            grid.Children.Add(paradoxSampleTextBlock);
            grid.Children.Add(uiTextBlock);
            grid.Children.Add(paradoxLogoImageElement);
            grid.Children.Add(touchStartLabel);

            // Add the background
            var background = new ImageElement { Source = uiImages["background_uiimage"], StretchType = StretchType.Fill };
            background.SetPanelZIndex(-1);

            Entity.Get<UIComponent>().RootElement = new UniformGrid { Children = { background, grid } };
        }
Beispiel #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);
        }