Welcome to Jacksonville Developers User Group Sign in | Join | Help

CSS For Windows Controls (Part II)

In my last post I through out a simple idea for making the physical styling of WinForm controls an easier task. It seems that it is necessary to further clarify where I was going with this thought. In a comment posted despite obvious "...restrain," I feel several VERY incorrect conclusion were jumped to.  So let's begin:

In my previous post I was specifically presenting an idea to control the physicall appearance of WinForm controls.  Now a common practice when implementing either WEB or WinFom controls is to use inheritence to extend an already existing control.  For example, you may wish to inherit from the standard texbox control and extend the control to only accept valid US Phone numbers.  The validation could be handled using a regular expression. While the graphical look and feel can be controlled via inheritance there remains one gaping hole. The developer is responsible for deciding how the control looks.

My point is to seperate the developer from controlling the appearance of the controls.  Under this model the same WinForm controls could be used in multiple WinForm applications or Smart Client Applications and the appearance can be easily changed per application via CSS.  If a company develops applications for both the Web and Windows then the talents of the Web Designer could be put to good use styling WinForm and/or SmartClient Controls.  To revamp the look of an application just apply a new CSS. 

Once again this is only an idea but it seems to have potential XAML.

 

Published Sunday, January 15, 2006 10:18 PM by dbottjer
Filed Under:

Comments

Monday, January 16, 2006 9:13 AM by aconnell

# re: CSS For Windows Controls (Part II)

You don't have to wait for XAML... first, OTS you can look at Windows XP themes.

Second, look at some WinForm control suites like DevExpress.com sells. You can create various skins for their controls and in your WinForm app, provide a way to add & chose different skins. There's even a skin creation tool that DevExpress gives away for free (I think).

Point: You can do this today. However, there's a reason why it's not a widespread standard. Users of Windows apps expect the same look & feel across all of them. Office 2003 always breaks the mold as it's the spearhead of the new MSFT UI designs, but you see their other apps pick it up as they evolve. Some apps are more "webby", such as MSFT Money & CRM. These are called intuitive designs... they are made to be more "webby" than WinForms.

IMHO: doesn't make sense to make your WinForm look unique from other Windows apps because that's not what the user is expecting. When it comes to web, that's a different story.
Monday, January 16, 2006 9:03 PM by Jonathan Bates

# re: CSS For Windows Controls (Part II)

I am reminded of some politico's statement a few years back to the tune of "Some of our friends feel strongly one way, some of our friends feel strongly another way. We agree with our friends."

I agree with a general statement of Mr Connell's, that the web is for web apps and Windows is for Windows apps. There is a certain look-n-feel style that you are trying to plug into when working in Windows, so as to flatten the learning curve with your apps UI.

But I think what Mr Bottjer is trying to get across might be the following: The web's presentation is markup as parsed by a browser. In recent years, a huge push to seperate that markup into data(HTML) and pretty bangles(CSS). Why can't we have CSS for Windows?

I suppose Mr Connell is correct with mentioning Windows XP themes. I have run into my fair share of presntation issues when users decide to incorporate non-standard, non-business themes and my app reacts with them (nothing more fun than trying to debug an issue at an associates desk and the mouse pointer looks like a butterfly and all the text is bold italic comic sans). My controls were taking the default sytles from their hosting form, which were in turn taking their style cues from the OS. In order to enforce a corporate look-n-feel consistency, I had to disable this default behaviour and institute my own definition of style (meaning, like me, it had none when I was done). It would have been easier if I could have just dropped a CSS on them, like I would on the web, instead of recompile/redistribute.

I mentioned XAML earlier because it is markup that is parsed (similiar to the web. In fact, some of the things I have read about XAML compare the new OS to being one big XAML browser). And like the trend de jour of the web, with a seperation between your data and your presentation, its probably not all that far-fetched that we start writing things like HelloWorld.xaml with an accompaning HelloWorld.css.
Tuesday, January 17, 2006 10:06 AM by dbottjer

# re: CSS For Windows Controls (Part II)

Great comments guys! Thanks for the input. Jonathan you really summed things up perfectly.
Anonymous comments are disabled