WPF Blend tools vs hand-coded XAML for interface controls?

Personally I would only use any designer for drafting and real-time display of the visual representation of my hand-written code. The generated code may not be horrible but once you need to go into it to do something manually you will have a hard time finding everything you need if you did not write it yourself. Also Blend slices things up quite a lot (create resource & reference it) while I like to nest things in place if they are only used once (i do not know if the code generator could be adjusted in that regard).

Up vote 0 down vote favorite share g+ share fb share tw.

Hi this might seem like a dumb question, but I was looking for a little feedback. I am designer working with a development team on a WPF application. We installed Expression Blend 4.

I new to WPF/Silverlight, but I have jumped right in and I think it's great. However, I did notice that xaml code that can get generated when using Expression Blend can sometimes be overly obnoxious. For example, I created a Control Template for a button with Blend and the markup was like 100 lines of code.

Then I created my own control template that was only 20 lines or so and it did exactly the same thing. I did the same thing for a listview and wow, that amount of code that was generated for a ListView template was RIDICULOUS. So again, I created my own styles and templates and the result was A LOT less xaml code.

The app we are creating is going to be pretty big I guess, so my question is, is it that much of a concern for performance if I were to simply create all design/interface elements using blend GUI, even though the generated code can be a lot more extensive? I can see how using Blend tools for design can make things a lot easier, but just like when designing websites, I have never used design view in Dreamweaver because the code that gets generated is pure crap. Any insight would be greatly appreciated.

Thanks a lot wpf xaml expression-blend blend link|improve this question asked Jul 27 '11 at 13:41kdub3267 65% accept rate.

Personally I would only use any designer for drafting and real-time display of the visual representation of my hand-written code. The generated code may not be horrible but once you need to go into it to do something manually you will have a hard time finding everything you need if you did not write it yourself. Also Blend slices things up quite a lot (create resource & reference it) while I like to nest things in place if they are only used once (i do not know if the code generator could be adjusted in that regard).

It should not be performace concern that the templates are big, if you just copy the default ones used they are quite huge themselves and it's not really an issue.

Nesting things in place increases clutter and reduces readability. Modular design is not only for re-usability. – Hasan Khan Jul 27 '11 at 14:03 @HasanKhan: It disrupts the workflow though (because you need to go up and find the resource that is being referenced) and makes it harder to find as the object layout becomes linear (one reasource after another at the same level).

– H.B. Jul 27 '11 at 14:05.

I'm guessing the control template you generated for the button didn't actually do the exact same thing as the default one which you copied in Blend. You may think it did, but I'm guessing it was missing something. For example, did your template handle all 9 visual states that are used by a button?

If you had only 20 lines of XAML, probably not. And yes, the ListView control template is quite large because it's quite a complicated control under the covers. In general, I wouldn't worry about generating large control templates.

It's going to happen. The runtime handles this quite well, in general. Unlike Dreamweaver, Blend generally gives you pretty good code.

Performance only becomes an issue if you misuse resource dictionaries by doing something ill-advised such as setting the build action to embedded resource in visual studio. (I believe this creates a loose XAML file which must be parsed and compiled at runtime instead of compile time. ) The key to maintaining your sanity is organization.

Just like with a website, you need to come up with an organization scheme for how you're going to store your control templates.

You're right, my control didn't take into account all triggers/or visual states. What I did was, right mouse button click on the button in the objects/timeline panel, click edit template->Edit a copy, and what blend does introduce all the Microsoft default theme code declarations, it was quite garbled if you ask me and not too organized, what I created, only took into account the actual look of it, and it was a lot more organized. But you're right about maintaining sanity, I think I have what is a pretty organized system for managing my styles/templates.

– kdub Jul 28 '11 at 12:27 Initially the default control templates look quite garbled. Once you've been doing it for a while it starts to make sense. For example, I can now read the button template and understand it.

The ListView template is simply too big to hold in my head. But that's where Blend really shines, once you learn the ins and outs. Try generating a default button template and then going to the States tab -- more information should be revealed.

:) – Mike Post Jul 28 '11 at 13:36.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions