I have several Silverlight component which are going to be used inside the browser, is it possible to pass the styling from the page to the Silverlight components?
I'm aware of 'initParams' in Silverlight and how these could be used to do this, but what I wanted to know is there any support for CSS and what is the preferred way to do styling in Silverlight, I guess it will be based around resource files.
Cheers
Ollie
There is no css support in Silverlight. In Xaml we have the Style element, which allows you to create styles and then apply them to controls. Here is a tutorial that explains the basics pretty well:
http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-4-using-style-elements-to-better-encapsulate-look-and-feel.aspx
Related
Is there a sort of css framework which i can add to a gwt project, and this will completely set a new UI to my gwt application. Sort of changing the look and feel.
I love GWT, but others like Vaadin are so good styled, if there were a complete set of css librarys that would make my app a lot nicer would we great.
I think we can be great developers but not so good designers.
Thanks!
I would recommend starting with http://gwtbootstrap.github.io/
As well as: https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCss
I would then dive deeper into the GWT docs to get a good handle on creating your custom themes. At some point any styling theme/framework will fail your needs and you will need to have some fundamentals for styling yourself.
Personally, I highly recommend using UiBinder and ClientBundle:
https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder
http://granitode.wordpress.com/2012/04/19/gwt-uibinder-using-a-clientbundle-with-cssresources/
#fguespe, I'm not aware of something such for example twitter bootstrap that you 'just' plug.
Eventually the 'web designer' needs to know about specific gwt CSS classes that impact the look and feel. If importing the GWT 'non plain' themes, you'll need to write customizations.
Yes indeed Vaadin and GXT provide a default nicer look and feel... Let's just fire all Google devs for a lack of focus :-)
I would ask if anyone has had experience in integrating a grid based CSS system (960 or similar) with a GWT uibinder application.
Our application is done with GWT 2.1, UIBinder and the latest GWT CSS capabilities, which have been really great to work with and enabled us to have a modular and flexible styling system. Our design team has returned a HTML layout with the corresponding grid css files and we are supposed to integrate them with our GWT code.
If we were to integrate the grid styles into our uibinder xml files we would have to wrap all our GWT widgets with divs with the right grid class names.
Personally I don't like the idea of mixing a completely separate grid css concern with the modular uibinder system, but I do understand the benefits the grid system can provide.
Any opinions or experiences? Pros and Cons for either approach?
We found ourselves in a similar position, having the app built around gwt, MVP and uibinder. This is great for developers, but it turned out to not be so great for designers. At the begining we gave them a html snapshot of our app + css and asked them to design it. They did't like this. It became a nightmare when customers wanted custom designs done by their designers.
The question is will simply wrapping you widgets in div be enough? Our designer provided custom buttons, tables, links, etc.. It was quite a task to force gwt widgets to look like the design.
So what we did was:
Replaced gwt-centric app design with html-centric one. This means we avoid generating html in code. We use classic html+JS+jQuery apporach, just instead of JS we have gwt and instead jQuery we use gwtQuery. We use only a few gwt widgets. Instead, in out Views we use gwtQuery to copy&expand example html that designer provided. GwtQuery can be externalized: all selectors can be put in one (or many) external interfaces, if a design changes (customers want changes or even bring in their designs) this intersection of html and gwt is all in one place.
Ditched gwt 2.2 mvp (activities, places), for our own which is a simplified version of gwt 2.1 mvp architecture. We no longer have to add 2 new classes and update others (place, tokenizer, update place factory) to have a new place.
Is it possible to change the default template of each ASP.NET server control? In WPF and Silverlight, each control is supposed to be lookless, so the developer can provide a user-defined control template to change how the control looks. If, for example, I want to use an outer and inner square/rectangle other than an outer and inner circle in a RadioButton, how do I accomplish that?
Don't have much experience with ASP but we used to work with Prado a lot (a PHP framework that behaves much like ASP .NET).
I would say the easiest thing to do is assign a CSS class to the component, which you should be able to do to any ASP .NET component and then simply use CSS to style the component.
At the end of the day, its all spat out to the browser as HTML anyway, so there's no real reason why you couldn't style it using CSS.
I recommend you don't use the standard CSS classes, unless you want all instances of a particular component to the look the same for your application.
We write a lot of Ajax apps and this is what we do.
ASP.NET has support for Themes and Skins. You can use a combination of skins and CSS (packaged up into a theme for convenience) to apply some styles to your controls. However, different browsers on different operating systems may render various controls slightly differently (for example take a look at how radio buttons are rendered). I'm not sure how much control you'll have over that behavior.
i want to manage all the design of my website(asp.net) through my css.
my client requirement is he should be able to change all design of website within 4-5 hrs.
is this possible.
is there any trick to do this?
Sure it is. ASP.NET doesn't but render html, css and javascript. What you need it to let it render the html you're after and hook in css for layouting.
ASP.NET also provides you with some great functionality: Themes and skins. These make changing css, images, ... a snap by either configuration or setting a certain premaid theme in code. I suggest you take a look at these videos for more information:
Customize my Site with Profiles and Themes?
Create User Selectable Themes for a Web Site
Use Skins with CSS for a Flexible and Maintainable ASP.NET Web Site
That's a very tall order indeed. By design does the client mean the color/theme or also the layout?
Basically is boils down to the following:
1. Generate semantic html only from you ASP.NET code. That is no in-line style and use meaning full css class names for html that needs to be styled
2. Break your css files into two. One for style and layout and another for color. If you're using images, they should be a part of your color css file
You can start here but also be clear about what your client means by "should be able to change the design within 4-5 hours".
Yes this possible if you have good knowledge of CSS i.e. 2 and 3. Have look at below links which can provide you and idea about layouts fully dependent on CSS
Yui library
Yui CSS tools
Many more ideas like CSS sprite can be used to achieve what you need
I know styling is possible in SL, but I have a large web app that has both HTML and SL so it would be really useful if they could use the same style sheet...
Is it possible?
Thanks.
I would have to say no. If for no other reason than Microsoft's poor track record in regards to CSS (even their leading browser generation is 10 years behind competing CSS implementations). The Word/Outlook engine is atrocious at CSS. If silverlight supports CSS you can bet it'll be a dog's breakfast.
On the other hand SVG supports CSS so you might want to look into that as an alternative.
Silverlight is a Web application and not a Web form. You'd have to use the Resource.XAML file in order to apply styling to your Silverlight application.
CSS and XAML are incompatible sadly. In Silverlight 'Stylesheets' are called ResourceDictionaries, which live in the Silverlight Project.
I created a free Silverlight theme which has several ResourceDictionaries, one for the colours (Brushes.xaml) and one to style the controls, it might be worth downloading the project to see how it works: http://www.blackspike.com/site/silverlight/free-silverlight-4-beta-skin