Applying stylesheets to VB.net form controls - css

I'm using a Windows Form Application in Visual Studio 2013 to design a prototype for a software. I'm not a software-developer, the only purpose of the project is to communicate with the dev-team to let them know what the end-product is supposed to look like.
There is not really much flexibility when it comes to designing control, like buttons, textboxes, etc. so I was wondering if it is possible to attach stylesheets to VB.NET projects? Thank you

There is not really much flexibility when it comes to designing
control, like buttons, textboxes, etc.
NO. winforms is a really old technology that basically has no amount of built-in support for custom UIs. It is not recommended for any new projects (only to maintain legacy applications) and it will be completely useless if you're not a developer, since any sort of custom look and feel needs to be done with an ugly procedural code technique called "owner draw", which requires too much code for anything, and is unable to provide professional-looking UIs due to the lack of hardware acceleration and lack of support for pixel-independent UIs.
If you're doing a prototype (as opposed to a real application), as others have recommended, you should use design tools such as Photoshop, or maybe a quick HTML + CSS kind of approach.
Otherwise, you can easily create a modern-looking application using a technology that is the replacement of winforms, called Windows Presentation Foundation, or WPF, for short.
There's also a design tool made specifically for this technology, called Expression Blend, which is bundled with recent versions of Visual Studio, and offers a very designer-centric approach to building UIs:
To summarize: winforms is useless. Use proper, relevant, current technology instead.

There are no such things as stylesheets in WinForms applications. You can change the appareance on a form and control basis by changing the Appearance properties.
You can create base controls and forms that have your appearance changes and then use those to create other forms to make things easier to design out the screen.
There are also 3rd party control sets that do have skins/themes, which maybe what you want but you have to purchase them first then you are limited to that control suite.

Related

Learning Web Design as a Form Designer

I am trying to learn ASP.NET (C#) and the biggest struggle I am having is the design aspects of it. I have primarily been a windows form designer. All of the projects I have worked on have used windows forms and it was much more intuitive and cleaner to design in than HTML/CSS. I am trying to learn how to design web pages, but it seems all "design" needs to be done in CSS. How do you design something you don't see and just use pixels and references to other objects? I don't see how you design anything that way.
What is the best way for me to be able to effectively design for websites using CSS and ASP.NET coming from a more visual approach of windows forms? I have read 3 books on ASP.NET and it makes sense but all of the design is done is source views and CSS sheets. Is there another method or approach I should be aware of? I am using VS 2015 BTW as my IDE.
Please and thanks
CSS and HTML are the building blocks of the Web. Like you, I used to struggle moving from the Drag and Drop world of VS 2003 after initially starting out with just Netscape and Notepad in college. Drag and Drop, like Web Forms, is an unhealthy layer of abstraction in that it removes us from a true understanding of how the Web works.
Just accept that this is the nature of things and stop fighting it. Back in the days of VS 2003, our team would set up VS so as to never default to the designer panel when starting or opening projects. Besides, the tool was totally undependable and created a tangled Frontpage-style mess of so-called HTML.
Make the switch to pure, semantic markup and CSS. Download a good template from a site like Creative Market (I usually search using "Bootstrap 3") to learn from. Study HTML5, CSS3 and RWD (Responsive Web Design) and let yourself have some fun. Yes, it really CAN be fun.
Work by switching from your IDE to the browser and back again.

Is there something equivalent to PrimeFaces for ASP.NET?

I'm being a ASP.NET developer over years but recently I started to work with some PrimeFaces solutions with JSF 2.0. I haven't nothing to complain about it.
It is worth emphasizing a few points that did ​​me likes the PrimeFaces: many components, easy to use, fully based on jQuery and jQuery UI (which are very important to me) and very focused on web standards (even more important to me).
But there are some cases that I would really want my server-side with ASP.NET. I don't want to start a discussion here about advantages between JSP and ASP.NET, both has many motives to be used.
Well, the standard ASP.NET components aren't jQuery based, aren't themable with jQuery UI Themes, aren't fully based on web standards (a big problem) and the variability is much more simple (there aren't Carousel, Accordion, Captcha, Slider, Spinner, etc, etc, etc).
EDIT
Continuing the saga, the #Raynos answers inspired me to study lighter possibilities, like the suggested manos. But I really would like something a little more automated, at least in the HTML generation for common controls. Someone known working CRUD samples for manos or additional modules supporting this task?
Recalling that the main question is still open anyway: Do you know any UI Framework for ASP.NET based on the same ideas of PrimeFaces, prefered open-source like it is?
I suppose we cannot answer your question with something simple. As showed by other answers, unfortunately we don't have in ASP.NET any UI framework fully web standards based.
You surelly have that choice about not using ASP.NET but another .NET Framework based engine. I really think that ASP.NET MVC would be the more closest to JSF and so to PrimeFaces. But it haven't a large set of builtin controls based on jQuery as you liked on PrimeFaces. Also, if you only used up to now the vanilla ASP.NET, the MVC concept can be very confusing to start through a professional project.
It may be safer to continue with your technology knowledge while learning something totally new. Even so I don't indicate manos to your project, although it shows to be very light and stable. Furthermore, with it you would need to "recreate the wheel" for many tasks that ASP.NET knows to do well within the standards and such.
Based on these arguments, it seems that in your case you (or your team) is so familiar with ASP.NET that your immediate need is to use good tools to improve the shortcomings of ASP.NET on HTML5, web standards and themes. Then you don't need to change everything you knows right now, just improve what you already know (and of course we recommend that you consider these other approaches gradually).
So let a few helpful hints for you:
First read about and download a sample of a good architecture using HTML5, jQuery and jQuery UI. This post covers all those technologies and have the full source code to download.
Also have in mind that you don't need start your project from scratch. There is the great HTML5 BoilerPlate which comes with dozens of good pratices (and a nice Web.config created with many nice ideas). Important note that it's also based on jQuery as you want.
Maybe you already have some incredible themes created for PrimeFaces and you would like to use on your ASP.NET projet. Then remember: to take advantage of the jQuery UI Themes you just needs using class names and DOM hierarchy. If your PrimeFaces Complex DataTable gerenates an incredible HTML which is so beautifull with your CSS, just use the same generated HTML inside a UserControl so you can reuse it around all yours pages without needing rewriting all the HTML.
Also remember that PrimeFaces is opensource and because of it you always can open the sources, read the jQuery codes and reuse what you really think are perfect for you.
Then, finally, there are many tools and approaches to support you enjoy what you've done with PrimeFaces and also enjoy your existing knowledge in ASP.NET. Unfortunately we don't have done something like this to ASP.NET, but maybe what you'll do will be so good that you can publish opensource for everyone?
PrimeFaces for ASP.NET is announced. http://blog.primefaces.org/?p=2128
Sounds like you need ASP.Net MVC instead of ASP.Net Web Forms, this gives you much more control.
You have the asp.net mvc html helpers toolkit, see: http://weblogs.asp.net/gunnarpeipman/archive/2010/08/16/asp-net-mvc-meets-html5.aspx
I'm not aware of great open-source .NET integrated UIs, but Telerik RadControls are themeable (sp?), standards compliant, integrated with ASP.NET, and built with jQuery. They are really great if you have a few hundred dollars to burn.
Otherwise, AjaxControlToolkit is integrated with ASP.NET and open source but I'm not crazy about it. It's not based on jQuery but I think it is standards compliant.
Sadly, the open source communities tend to shy away from .NET (and Microsoft in general).
PrimeFaces For .NET Cancelled
PrimeFaces for ASP.NET WebForms project has been cancelled after two releases and as PrimeTek we have decided not to do further investments. Instead of .NET, our secondary focus will be PrimeUI who is very close to 1.0 release already and can be used with any web framework.
You can check out the PrimeUI library which is:
a collection of rich javascript widgets based on jQuery UI. PrimeUI is a spin-off from the popular JavaServer Faces Component Suite, PrimeFaces.

Collaboration platform for developers and designers

Recently our newest web designer asked me why we use ASP.NET for our website. Reading through his question to the real one, I started thinking about it myself. Why are we using ASP.NET for web development?
The problem we find so far is colaboration between the design team and developers. Typically our designers create some snazzy cool look crayon laced web pages, then show them off for approval in all their glory. Once approved, the developers rip the HTML out and shove it in to ASP master and detail pages, and huzzah! out comes pretty website.
Since Dreamweaver doesn't play nice with Visual Studio, this is the same process for even small tweaks and changes. I would prefer to just write the backend and let the designers draw the pretty pictures and fancy CSS. Our current websites have plenty of reason to use ASP on nearly every page, so I can't do half in HTML, the other half in ASP.
I have no aversion to doing something else, another language, CMS platform, some other random buzzword, etc...
What are your experiences with this design situation? Are we doing it the hard way? Should we consider alternate platforms and languages? Are there any good, proven ways to allow designers to work on ASP (while still using Dreamweaver)?
Start learning Asp.net MVC as soon as possible. Designers will love you for that. :) And you'll be up to date with new development technologies that will also make your solutions much more robust and less complicated.
But otherwise. Designers should be able to read XHTML fluently. Learning asp.net semantics shouldn't be too hard. Then give then Visual Studio where they can manipulate content. As long as they know how asp.net web forms work things should be fine. They'll probably be able to do majority of things using just CSS. I know I can. Sometimes I do have to check resulting HTML, but it works.
Aside from Wicket (a java web framework), I don't know of any framework or language that would allow designers to continue to work on the design once developers have started to add logic to it.
I would suggest two things though:
Use a MVC framework - ASP.NET MVC, Ruby on Rails, Django, etc since this allows for far more separation of presentation and logic
Keep your presentation layer as stupid as possible and use helpers as much as possible or even better, put the logic in the domain objects. The view should only show or get data with absolutely no logic for processing data, this will keep the pages much more designer friendly.
I find your question very interesting because no matter what kind of technology the project uses the interfaces between the different roles will always cause some friction. I am not sure if there is a technological solution to this communication issue because the designer and developer speak literally different languages.
Depending on the skillset of your designers and developers an additional layer might help you out. I do not know how ASPX works but i am sure there will equivalents to the concepts of other technologies.
In case you have mainly static content which can be expressed in XML than you could provide the backend which delivers the content in XML with a defined Schema and your designers could describe the transformation in XHTML and CSS via XSLT. Given that your designer are capable using XHTML and CSS the addtional effort to learn XML and XSLT is not that huge. I find this solution much powerful than template languages which try to emulate the richness of the serverside scripting language in their own limited constructs. In case you have dynamic elements on the clientside like DHTML, AJAX or you name it you could define your own xml tags which are transformed to richer client side objects after the designer did their work. I guess the designer will understand the usage of these special tags and you provide the proper translation into client side objects.
I used this approach with some coworkes based on PHP. PHP was only the driver for the transformation. The content was assembled into xml with special tags which were transformed into XHTML and CSS via XSLT. Once the objects and the transformation for the different objects is defined you build up a library which can help to shorten the developement cycle of new pages of you webapplication. The benefit of the extra work is, that you designer can change the layout of the page without ever touching you server side code.
Maybe this helps.
Consider using either Expression Web or SharePoint Designer. The latter is now free.
I know you specify dreamweaver, but have you looked at Blend? It plays very nice with Visual Studio and is quite a nice app. to work with.

Can C++.NET and J# be used to make a website?

I didn't see an option to create a web site in the c++ area. Is there a way around this or am I just stuck with C# and VB.NET
A bit of googling turned this up, not sure how applicable it still is:
http://www.codeproject.com/KB/mcpp/helloworldmc.aspx
However, I'd question WHY you'd want to use C++.NET over C#, given that the languages are fairly similar at the basic level. Any perceived "speedups" would probably not be very noticable given that they both compile to the same IL, and as such are both subject to the JIT-compiler.
You can probably make your website work using C++/CLI. There is no tight coupling between a .NET page (aspx or ascx) and the language of implementation. You might even get the intellisense from within the aspx/ascx files but don't quote me on that.
So to set this up you would need to create a C++/CLI project and use managed C++ to extend Page, Control, etc classes, use HttpContext etc.
Another question is whether or not there is any point doing that. You would still be targeting .NET and calling to the same API. There won't be much performance benefit if at all and you will lose the IDE support for creating controls and you wouldn't be able to use WebForms from the designer.
Edit. If you haven't done ASP.NET before you will almost definitely be firing up a normal ASP.NET project and seeing how to implement something, which classes to extend etc. So it kind of defeats the idea of using another language.
You can, in theory, use any .NET language to build ASP.NET pages. F#, for example, is fully supported in VS 2010. Whether all languages are fully supported in the tools is another question -- particularly for a language like J# that has been deprecated beyond VS 2005 and doesn't support the full depth of features of the other languages (such as the ability to create new attributes).
At a minimum, you will need to do things like define an appropriate build provider to get things going.

Are Visual Studio web projects Web Standard friendly?

I'm struggling with a few in-house developers that are creating some web apps in VS 2008 using C#.
It appears that the native tools and components in VS 2008 are not being nice about creating Web Standard code.
For example, the navigation component creates items in its own table structure.
Is there anyway to make a web project from Visual Studio create nice, clean, browser friendly code?
You can use CSS Friendly Control Adapters to alter the output of the current ASP.NET controls. It's easy to set up and you don't have to change any existing source code.
If you're bound to ASP.NET WinForms, you could create you own set of controls or use 3rd party controls. There is also a XHTML configuration setting you could set to Strict, so that the controls try to render more valid core.
When you really want to write nice, clean, browser friendly code, you could take a look at ASP.NET MVC. ASP.NET MVC gives you complete control of the output, but that means you have to do all the things WinForms currently does for you, yourself...
Certainly. If a component doesn't produce markup you like, then you don't use it. It's just that simple.
Having said that, be sure to check out Visual Studio 2010 beta 1 to see if your issues have been addressed. If they haven't, then you get to complain about them in a way that might get them fixed.
VS 2008 web projects don't do anything web-standards-unfriendly. The standard ASP.NET controls (like the menu control you mentioned)? That's another story -- some use a mess of tables and javascript to do their thing.
The good news? You can use what you want of ASP.NET without having to use those controls if you don't want to.
Go MVC !!! you will have complete controle over your UI
My two cents: machine-generated code is almost never as standards-compliant as the code I write by hand, especially when you get into fancy widgets and whatnot. The obvious trade off is that writing code by hand can be tedious and time-consuming.
We've come a long ways since the dark ages of code-junk that frontpage or dreamweaver used to spit out, but even still...
In the end, your code is only ever as good as your programmers.
The Web Projects themselves are simply containers for the code that you create and a mechanism for managing and building the compiled project.
Based on my experience, the controls generated by VS comply to web standards ... that being said, browsers differ on which standards they do or do not enforce and how they enforce them. For the most part, you have a high level of control of the HTML that is output from your page. The table structure generted by the navigation control id valid HTML - you may be wanting to avoid the use of tables in which case, that particular control might not be for you.
For the most part, when you have a complex control you will need to take what you get - the HTML that is generated may not be intuitive to you and your team but that is often the price paid for the time savings gained by using a pre-built control, particularly one that is intended to service the needs of a wide variety of uses. (The same can be said for most code/script libraries you use/buy/find)
Many controls offer templating that provides you with the ability to define a template for how the resultant HTML is generated.
If you want cleaner markup, you have a few options:
a) Check out the CSS Friendly control adapters from codeplex. They help alot with certain controls.
b) Avoid the more complex server controls. There is very little one can't do nearly as effectively with a repeater and some user controls that one can't do with most any databound control for instance.
c) Try ASP.NET MVC. No neato server controls to do UI lifting, but it will let you make very, very clean UIs.

Resources