private void CreateRenderTargets(GraphicsDevice device)
            {
                if (gradient != null)
                {
                    // Create the rendertarget.
                    int size = 64;
                    rt = new RenderTarget2D(device, size, size, false, SurfaceFormat.Color, DepthFormat.None);
                    InGame.GetRT("UIGridPictureListElement", rt);

                    // Render the gradient into the rendertarget.
                    InGame.SetRenderTarget(rt);

                    ScreenSpaceQuad quad = ScreenSpaceQuad.GetInstance();
                    quad.RenderGradient(gradient);

                    // Restore backbuffer.
                    InGame.RestoreRenderTarget();
                }
            }
        public override void Update(ref Matrix parentMatrix)
        {
            // Do we need to render the gradients?
            GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice;
            RenderTarget2D rt     = UI2D.Shared.RenderTarget64_64;

            for (int i = 0; i < pics.Count; i++)
            {
                if (pics[i].texture == null)
                {
                    if (pics[i].gradient >= 0)
                    {
                        // Create the texture gradient.
                        InGame.SetRenderTarget(rt);
                        ScreenSpaceQuad quad = ScreenSpaceQuad.GetInstance();
                        quad.RenderGradient(SkyBox.Gradient(pics[i].gradient));
                        InGame.RestoreRenderTarget();

                        pics[i].texture = new Texture2D(device, 64, 64, false, SurfaceFormat.Color);

                        // Copy rendertarget result into texture.
                        int[] data = new int[64 * 64];
                        rt.GetData <int>(data);
                        pics[i].texture.SetData <int>(data);
                    }
                    else
                    {
                        // Load the texture image.
                        pics[i].texture = BokuGame.Load <Texture2D>(BokuGame.Settings.MediaPath + @"Textures\" + pics[i].picName);
                    }
                    dirty = true;
                }
            }

            // Check for input but only if selected.
            if (selected)
            {
                GamePadInput pad = GamePadInput.GetGamePad0();

                if (Actions.ComboRight.WasPressedOrRepeat)
                {
                    curIndex = (curIndex + 1) % pics.Count;
                    Foley.PlayClickUp();
                    recalcPositions = true;
                    dirty           = true;
                }

                if (Actions.ComboLeft.WasPressedOrRepeat)
                {
                    curIndex = (curIndex + pics.Count - 1) % pics.Count;
                    Foley.PlayClickDown();
                    recalcPositions = true;
                    dirty           = true;
                }
            }

            if (recalcPositions)
            {
                if (onChange != null)
                {
                    OnChange(CurIndex);
                }
                RefreshPositions();
            }
            RefreshTexture();

            base.Update(ref parentMatrix);
        }   // end of UIGridModularPictureListElement Update()