XAF Web – Add CSS Style

First, I have to admit CSS and Javascript are not my stronger points. With that out of the way, some times a simple change makes a big difference in the appearance of your app.

Well, let’s change the color of the header bar in our XAF Web application.

public class AddStyleController : ViewController
    {

        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();

            LiteralControl style = new LiteralControl();
            style.Text = "<style type='text/css' scoped>.white { background-color: palegreen; }</style>";
            ((Control)View.Control).Controls.Add(style);


        }
    }

And good to go:

Source Code: https://github.com/jjcolumb/BlogDemo

Until next time, XAF out!

 

Posted in XAF

One thought on “XAF Web – Add CSS Style

Leave a Reply

Your email address will not be published.