Exemple #1
0
        protected override Task LoadContent()
        {
            // Set dependency properties test values.
            TextBlock.TextColorPropertyKey.DefaultValueMetadata     = DefaultValueMetadata.Static(Color.LightGray);
            EditText.TextColorPropertyKey.DefaultValueMetadata      = DefaultValueMetadata.Static(Color.LightGray);
            EditText.SelectionColorPropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(Color.FromAbgr(0x623574FF));
            EditText.CaretColorPropertyKey.DefaultValueMetadata     = DefaultValueMetadata.Static(Color.FromAbgr(0xF0F0F0FF));
            var buttonPressedTexture    = TextureExtensions.CreateTextureFromFileData(GraphicsDevice, ElementTestDesigns.ButtonPressed);
            var buttonNotPressedTexture = TextureExtensions.CreateTextureFromFileData(GraphicsDevice, ElementTestDesigns.ButtonNotPressed);
            var buttonOverredTexture    = TextureExtensions.CreateTextureFromFileData(GraphicsDevice, ElementTestDesigns.ButtonOverred);

            Button.PressedImagePropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(new UIImage("Test button pressed design", buttonPressedTexture)
            {
                Borders = 8 * Vector4.One
            });
            Button.NotPressedImagePropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(new UIImage("Test button not pressed design", buttonNotPressedTexture)
            {
                Borders = 8 * Vector4.One
            });
            Button.MouseOverImagePropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(new UIImage("Test button overred design", buttonOverredTexture)
            {
                Borders = 8 * Vector4.One
            });
            var editActiveTexture   = TextureExtensions.CreateTextureFromFileData(GraphicsDevice, ElementTestDesigns.EditTextActive);
            var editInactiveTexture = TextureExtensions.CreateTextureFromFileData(GraphicsDevice, ElementTestDesigns.EditTextInactive);
            var editOverredTexture  = TextureExtensions.CreateTextureFromFileData(GraphicsDevice, ElementTestDesigns.EditTextOverred);

            EditText.ActiveImagePropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(new UIImage("Test edit active design", editActiveTexture)
            {
                Borders = 12 * Vector4.One
            });
            EditText.InactiveImagePropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(new UIImage("Test edit inactive design", editInactiveTexture)
            {
                Borders = 12 * Vector4.One
            });
            EditText.MouseOverImagePropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(new UIImage("Test edit overred design", editOverredTexture)
            {
                Borders = 12 * Vector4.One
            });
            var toggleButtonChecked       = TextureExtensions.CreateTextureFromFileData(GraphicsDevice, ElementTestDesigns.ToggleButtonChecked);
            var toggleButtonUnchecked     = TextureExtensions.CreateTextureFromFileData(GraphicsDevice, ElementTestDesigns.ToggleButtonUnchecked);
            var toggleButtonIndeterminate = TextureExtensions.CreateTextureFromFileData(GraphicsDevice, ElementTestDesigns.ToggleButtonIndeterminate);

            ToggleButton.CheckedImagePropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(new UIImage("Test toggle button checked design", toggleButtonChecked)
            {
                Borders = 8 * Vector4.One
            });
            ToggleButton.UncheckedImagePropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(new UIImage("Test toggle button unchecked design", toggleButtonUnchecked)
            {
                Borders = 8 * Vector4.One
            });
            ToggleButton.IndeterminateImagePropertyKey.DefaultValueMetadata = DefaultValueMetadata.Static(new UIImage("Test toggle button indeterminate design", toggleButtonIndeterminate)
            {
                Borders = 8 * Vector4.One
            });

            Window.IsMouseVisible = true;
            UI.VirtualResolution  = new Vector3(1000, 500, 500);

            CreatePipeline();

            return(base.LoadContent());
        }