Wednesday, August 31, 2005


As all of you already know, on Web development (be it with PHP, or Java, or .NET or plain HTML) there are some files called Cascade Style Sheets, or CSS, which force all our Web pages to share a coherent and uniform visual style. They are text files one can specify global styles for our pages, so we can specify that all our tables are gonna have a 5 pixel wide yellow border, or the background of all of our pages is gonna be an specified image, etc. It has several undeniable advantages: besides giving a coherent look to all the pages of our application or Web site, it allows us to forget about the visual aspects of our pages and in order to change the appearance of our Web app we'll only have to edit a single text file form which all our pages will feed automatically. Try CSS Zen Garden so you can check by yourself the true power of style sheets.

Why the hell can't we have this for Windows Forms?

First of all we'd have to design a file (XML, for example) containing the design we want to apply to our forms, text boxes, dropdown lists, grids and so on. Of course, at first our XML based style file (XSS?) would only admit standard .NET controls, but I believe it could be easily extended to third-party controls.

Having those XSS files as a starting ground, the thing could work two ways.

First, as a Visual Studio add-in, we could have a button in the IDE with which we could select one of our premade XSS files and apply, on design time, the styles to all the forms and the controls of our application. Of course, if we later on add controls to the forms or forms to the application we should have to push that button again to make the new controls adhere to the norm. The controls would be saved and compiled with the chosen visual style already implemented on them.

Second, we could include a DLL made to read XSS files and change the appearance of our Windows application in runtime. If a user of our add-in wants the visual styles to be applied on his application at runtime, or wants the user to be able to change between several predefined visual styles (several premade XSS files), he'd only have to reference the DLL that allows him to make this changes.

First question: what do you think about it?
Second question: do you think there's already something like this avaliable?


  • Yeah, I believe there's something like this for Avalon. You can do styling of XAML.

    By Anonymous Haacked, at 5:04 PM  

Post a Comment

<< Home