none
My first thoughts on WPF with VS 2008 RTM and a few questions

    Question

  • Hi,
    For the first time yesterday, I played with WPF in Visual Studio 2008 RTM but there a few things that I disliked and I can't understand why they are like that. I also have a few questions about it:

    1) Have you compared the Properties window in WPF applications and WinForms applications?

    1.1) Why are the WPF Properties window so badly rendered (talking about the text)? All the text in the WinForms Properties window are much smoother.

    1.2) Why is the help gone? In WinForms Properties window we had little help topics in the bottom part of the window which explained a bit about each property. We don't have that anymore on the WPF Properties window. How can I have a quick glimpse of what that property means without going to the documentation, which, takes more time?

    1.3) Why some properties in the WPF Properties window are more difficult to set? For instance, the Image control and it's Source property. It's a simple TextBox... Why can't we get a little button like before where a new window would pop up, allowing us to select the image we want in the control? Either from disk or resources, now, that is so much harder to do... Or am I missing something?

    1.4) Where have the Events button gone? I miss it, now, is much harder to create an event, I have to do everything manually, which sucks. Why can't I just select an event from list, double-click on it and everything will be ready for me to code the events actions?

    2) What about the simple and most common controls like Buttons, Labels and all others?

    2.1) For starters, and just like 1.1, the text is badly rendered. Why is this? I honestly dislike to have an application with a bunch of labels and buttons on WPF, the text just looks so badly rendered. The one in WinForms is prefect! (by the way, I'm seeing the text in a laptop screen with ClearType enabled, dunno if that matters)

    2.2) I made a simple application test with some buttons, labels, ComboBoxes, etc and test it out on Windows Vista and Windows XP with all the 3 different visual styles colors. Why are the controls designed/rendered differently from the ones that are rendered if we do a WinForms applications? They just don't look right, don't look the same as the OS ones... You can see that difference better on the ComboBox. Just create 2 applications, one in WPF and the other in WinForms and check them both on XP (it's easier to spot the difference). You will see that they are not rendered the same way. The WPF control rendering looks so bad, why is that?

    3) Do we have Expression Blender like functionalities in VS2008? I mean, in Expression Blender, we can design our own buttons for instance, can we do that in VS2008? Or we will be limited to change the background/foreground and border colors?

    4) In every single WPF application project we create, there's a default Grid control. What exactly is this for and why do we need it to be there by default?
    Thursday, November 22, 2007 6:23 PM

All replies

  •  Nazgulled wrote:
    Hi,
    For the first time yesterday, I played with WPF in Visual Studio 2008 RTM but there a few things that I disliked and I can't understand why they are like that. I also have a few questions about it:

    1) Have you compared the Properties window in WPF applications and WinForms applications?

    1.1) Why are the WPF Properties window so badly rendered (talking about the text)? All the text in the WinForms Properties window are much smoother.

    1.2) Why is the help gone? In WinForms Properties window we had little help topics in the bottom part of the window which explained a bit about each property. We don't have that anymore on the WPF Properties window. How can I have a quick glimpse of what that property means without going to the documentation, which, takes more time?

    1.3) Why some properties in the WPF Properties window are more difficult to set? For instance, the Image control and it's Source property. It's a simple TextBox... Why can't we get a little button like before where a new window would pop up, allowing us to select the image we want in the control? Either from disk or resources, now, that is so much harder to do... Or am I missing something?

    1.4) Where have the Events button gone? I miss it, now, is much harder to create an event, I have to do everything manually, which sucks. Why can't I just select an event from list, double-click on it and everything will be ready for me to code the events actions?

    2) What about the simple and most common controls like Buttons, Labels and all others?

    2.1) For starters, and just like 1.1, the text is badly rendered. Why is this? I honestly dislike to have an application with a bunch of labels and buttons on WPF, the text just looks so badly rendered. The one in WinForms is prefect! (by the way, I'm seeing the text in a laptop screen with ClearType enabled, dunno if that matters)

    2.2) I made a simple application test with some buttons, labels, ComboBoxes, etc and test it out on Windows Vista and Windows XP with all the 3 different visual styles colors. Why are the controls designed/rendered differently from the ones that are rendered if we do a WinForms applications? They just don't look right, don't look the same as the OS ones... You can see that difference better on the ComboBox. Just create 2 applications, one in WPF and the other in WinForms and check them both on XP (it's easier to spot the difference). You will see that they are not rendered the same way. The WPF control rendering looks so bad, why is that?

    3) Do we have Expression Blender like functionalities in VS2008? I mean, in Expression Blender, we can design our own buttons for instance, can we do that in VS2008? Or we will be limited to change the background/foreground and border colors?

    4) In every single WPF application project we create, there's a default Grid control. What exactly is this for and why do we need it to be there by default?

     

    Hello:

     

    I will try to answer as many of these as I can. Smile

     

    1.) Not yet.

    1.1) I haven't experienced poorly rendered text yet.

    1.2) Not sure. They may be putting that in in a future update.

    1.3) Remember that WPF integration is fairly new to Visual Studio. If they fixed every issue immediately, we wouldn't have

           had Visual Studio 2008 until 2010.

    2.) Those controls are generated through code (e.g. <button></button>).

    2.1) same as 1.1 answer.

    2.2) They can be designed any way that you want them to be designed. All you have to do is edit the control template.

           WPF is rendered with DirectX and is Vector Based as far as I am aware. WPF is designed to allow you to create

           much more robust interfaces. It is not neccessarily meant to only mimic the look and feel of one OS. It is meant

           to be universal.

    3.) You can do everything that you can do in blend in Visual Studio 2008 (in code). You can completely redesign entire

         controls to look any way that you want. The good thing about this is that thanks to the power of WPF, you don't have

         to recode the functionality of the control. It all stays the same. Smile

    4.) It is a layout panel basically. Not sure why it is the default choice, but you can change it to any one of the layout

         panel types. Smile

     

    I hope this clears things up! Smile

    Friday, November 23, 2007 5:27 AM
  • 1.3) I don't think that's a reason... If they pushed WPF into VS2008, I think they should have done things correctly and good, not like this. I think they are pushing people to buy new software, like Expression Blend.

    2) This wasn't a question Stick out tongue

    2.2) I know, but what about people that just want windows to design the controls. WPF is powerful, but there are many people that want to do an application that just fit into windows and have special capabilities that only WPF provides. The controls should be rendered exactly the same way Windows/WinForms renders them, so they fit into the OS.

    3) Got it, but tha't sby code, if we want to do it visually, we need Expression Blend right? Too bad...

    About the text rendering, here's a sample:
    http://www.hdd.pt/imagens/1156962732properties.jpg

    Just compare the text rendering in both. The same happens if you compare labels, buttons, etc, rendered in a Windows Forms Application and a WPF Application.
    Friday, November 23, 2007 12:54 PM
  • The text issue has been known since the beta days. There are some registry tweaks you can do. They have been mentioned in this forum many times.

    http://forums.microsoft.com/MSDN/Search/Search.aspx?words=text+blurry&localechoice=9&SiteID=1&searchscope=forumscope&ForumID=119
    Friday, November 23, 2007 1:12 PM
  • I have the following information regarding the font issue (this was told on a Microsoft MSDN briefing about WPF):

    • WPF uses its own ClearType rendering engine
    • This issue mainly exists with small font sizes like 10pt and below
    • The tweak to set a registry value doesn't resolve the problem, it might only reduce the unwanted effect
    • The issue also depends on the font type - choosing specific fonts helps avoiding the problem

    Microsoft still has to come up with a fix for this. It is not fixed in Beta2 and RTM of Visual Studio 2008.

    I hope I could supply some additional information.

    Friday, November 23, 2007 2:49 PM
  • 1.1) Probably because it's rendered in WPF, and thus for the same reason as 2.1. Smile

    1.2) I don't know but I miss the contextual help too. Sad

    1.3) I believe with WPF the emphasis has been pushed to declarative XAML, and for things like images, it expects you to embed resources in the XAML file. Tho the real answer is probably that they haven't had time to do this yet in VS.

    2.2) The reason for this is WPF controls are entirely vector-based and using device-independent pixel measures. What this ultimately means is a more powerful representation of UI that can be scaled (and zoomed) without loss of fidelity. However, they could have done a better job of making the controls match exactly.

    Think of WPF as an investment in the future, when monitors have tens of thousands of pixels per dimension, and user interfaces are no longer pixel-based at all. With WPF, you'll get a nice sharp, clean and scalable UI versus pixelated bitmaps. Of course, that may be a while off yet. Wink

    Personally, I'd use the opportunity to fiddle around with designing and drawing your own controls and interfaces, since WPF makes that so much more possible than before.

    3) I believe MS is marketing these as two separate tools, meaning you have to pay twice.

    4) Grid is just the default because it's the most capable layout control for most interfaces. You can replace this with whatever you want (e.g. a dock control, stack panel, etc.), but I believe the root of the window must be a single element.

    HTH

    Friday, November 23, 2007 2:52 PM
  • I'm going to answer and post questions at the same time, now enumerating them as capital letters.

    1.3) That makes VS2008 look like an unfinished product... I mean, it's just stupid to have a textbox to input an image. Every code sample I could find on the net about the WPF Image control, allows me to set an image by code, but that change is only visible when I compile and run the application. I want it to be visible at design-time and I also want to embed and not load it externaly. A) I used to embed images accesing them through Properties.Resources. Can I still do that and set the image in design time on a WPF Window?

    2.2) I know about the vector-based thing and I think it's great, but like you said, they could have done a better job making them look exactly like the OS rendered ones. I coul try and change them myself, but one problem comes to my mind: B) When you create your own design, it will be equal in every OS/Visual Style, however, if you add a WPF Button and don't change it's visual, the button will be different depending on the OS/Visual Style. So, how could I *fix* the button so it matches the OS/Visual Style correctly.

    About the power of the WPF to create my own controls and interfaces, I don't want to fiddle around that. Right now, I just wanted the controls and the whole interface to match the currently used Windows Visual Style.

    3) That really sucks... Actually I don't have to pay for both, I already have a copy of VS2008 Pro from MSDNAA. If only Expression Blend was available through MSDNAA too, it would be so nice... But I don't think this type of app will ever be included in a program like MSDNAA.

    4) The only thing I don't understand about this grid thing is why it's there... I mean, in WinForms, we don't have a panel to add all the controls we want. We just add them to the form and that's it, why do we need a Grid on WPF? Why can't we just add controls to the Window itself? There must be a reason for a decision like that, conformity maybe?
    Friday, November 23, 2007 9:26 PM
  • I am not sure what could be wrong on your end, but that could be a bug. The images do show up at design time for me. Everything else that I have added so far has as well. Smile

     

    Friday, November 23, 2007 9:30 PM
  • Some good questions...

    A) The simplest way to use images in WPF is to add them to your project with a Build Action of Resource (NOT EmbeddedResource). This is a new WPF-specific setting that allows them to be accessed via a URI string. Then, in your property window simply use the uri string of the resource. Note that the project's folder structure is preserved in the URI, so if you have in your project a tree "Resources/Images/myImage.png", then that's exactly what you need to type into the Source property of the Image. If your image is accessible from the project, it should show up in the designer.

    B) I'm sure this would be so difficult (if even possible) as to not be worth it. The WPF team put a lot of work into making them match *very* closely while still being vector-based. The only way you could "improve" this is to set the styles to use bitmaps instead of vectors, but then, like you say, it wouldn't change with the system.

    C) (implied) Remember that in WinForms, a Form essentially has an implicit Panel that things are added to (Form itself behaves much like a Panel). In WPF the only thing implicit is that windows are content controls, meaning they have a single piece of content. This is for consistency I would presume, and makes the definition of a window more explicit since the layout mechanism is clearly stated. Grid is just one of the options and is added automatically because it is the most flexible. You don't NEED a grid in a window--you could add any object as the content of a window, it doesn't even have to be a layout control, but there can only be a single child of window.

    Logan
    Friday, November 23, 2007 9:43 PM
  • A) How exactly do I "build action of resource"? Do I just need to have the image in the project trre and use the URI string in the Image source and that's it? My first thought is that the image won't be embedded in the final exe but will have to be in the hdd, is this wrong? The image will in fact be embedded this way?

    B) Probably... To tell you the truth (besides the text rendering problem), i've only disliked the ComboBox control (from the ones i've seen). They differ too much from the WPF version and the OS version. The rest of the controls seem to be well designed vector-based to fit the OS look.

    C) Got it...
    Friday, November 23, 2007 10:35 PM
  • // Hmm, the Reply button would log you out of forums, and the Quote button just makes a reply without adding any quotings. Long live msdn forums.

     

    VS 9.0 and WPF designer: haven't played with RTM much, but before that the WPF designer would seem more like a preview-only thing to me. You cannot just drop a control to it, and editing properties seems to work better for XAML code than for the Properties window. Fortunately, things like logical layout support and convenient XAML syntax help with getting on with just a preview-only designer … Expression Blend's designer is indeed a little bit more useful at that.

     

    The combobox presentation is mainly about paddings around the combo items. Setting their min-height, or, better though, adding icons to the items gives them a native look.

     

    A single Window child and a Grid inside a window is simple. See, Window has no personal logic for laying out its children. Indeed, what should it do to them? Stack vertically? Dock to edges? Arrange in rows? And why just that?

     

    To define that, you need some arrange logic on the container. To choose among the arrangements available, you pick the proper container — some Panel inheritor, basically. Grid, StackPanel, DockPanel, WrapPanel, etc. That's why any Avalon element that does not have any special notions about how to arrange its children, like a button for instance, defines just a single Content child for its inners. There you put the appropriate panel, like a horizontal stack if you'd like an image-and-text button. And if you'd like a window with buttons at the bottom, you change its Grid to, say, a DockPanel and dock a StackPanel with buttons at its bottom.

    Friday, November 23, 2007 11:08 PM
  • Just add the image to your project, click it and in the properties pane set "Build Action" to "Resource". Files added in this manner are, in fact, embedded in the final assembly upon compilation. WPF uses the URI internally to identify the embedded resource. You can also, however, use the same URI (believe it or not) to access an external resource starting from the directory containing the executing assembly. So the choice is yours. If you want the latter, just set Build Action to Content.

    Logan
    Friday, November 23, 2007 11:15 PM
  • Got it, thank you all!
    Friday, November 23, 2007 11:41 PM
  • I'm not sure if this is blasphemous, but does anyone really NEED to use the WYSIWYG designer in Visual Studio?  IMO, the only thing that really excited me was the intellisense with the XAML.  I would like to be able to hook into events by double clicking ala Winforms, but that is only a minor nuisance.

     

    Some of these things are very valid complaints.  Others, well, seem like people expect that WPF == Winforms v3.0, which is not the case.  It's probably like when they first invented cars, I'm sure people were fustrated that there was no place to tie a mule to.  People try to apply the old model (I refuse to use the term paradigm) to the new one and you can't always look at it from that way.

     

    Overall I am very pleased with 2k8 and its WPF features...I just wish they had XAML intellisense in Blend.

     

    -Jer

     

     

     

    Friday, November 23, 2007 11:55 PM
  • A paradigm... isn't that when ten people give you their two cents worth?

    Cheers,
    Logan
    Saturday, November 24, 2007 12:06 AM
  • Na, that would be a parapennies! LOL Big Smile

     

    Saturday, November 24, 2007 12:21 AM
  • And why the hell the future must be one step back instead of one step forward?

    I'm not saying XALM is not powerful, but to me, having to remember lots of tags, properties and the like is a pain in the *** and I prefer something more visually. Why do you even bother to use VS then? Why don't you open notepad and start coding? I just don't think that what you said makes any sense.

    No, I don't think that WPF is WinForms 3.0 but the designer could have been better. Microsoft developed Expression Blend for a reason and I'm not talking about the "the coder is not the designer" thing.

    I think you gost stuck in the past and are one of those old school boys that type everything and don't even use mouse, no? If not, you look like one... In everything, the future is to have prettier interfaces, better user experience, better usuability and all that, why do we (coders) have to be different?

    I like to code, I enjoy programming in C# and create applications that look good. I intend to learn XALM and use it as I can, but I also like to design and all that doesn't mean I prefer to it by hand and type everything, cause I don't. If I can have a button that popups a window allowing me to select an image from the hdd to set it as the source for the Image control, I prefer that 100 times more than to type it all...

    But that's just me...

    And by the way, I don't think your cars/mules comparison made any sense at all...
    Saturday, November 24, 2007 2:00 AM
  • Wowah, a lot of tension in your post.  Nothing worth getting wired up over.  I was just saying WPF is a totally different but people are expecting to use it the same way they had with the old technology.  Not that a step forward is a step back, but when you go forward, your pespective has to do the same.

     

    Take XAML.  The intellisense support in this is great. You don't have to remember any tags/properties at all.  I wouldn't call this doing it by hand, as VS types 90% of it for me.  An image's source in the property window has a drop down for ALL images in your application.  Sure a "..." button to automate things would be great, but in no way does it slow anyone down.

     

    I'm sure the tooling will get better with time as you did have some good points.  I suppose MS could have eased the Winforms -> WPF change for the developers a bit more, but for the most part I think they did a great job for what it's purpose is for.

     

    -Jer

     

    Saturday, November 24, 2007 3:00 AM
  • The tension in my post is like the tension in your previous post. I'm not expecting that WPF works the same way, I was just expecting to be a little more easier (and I'm not talking about XALM + IntelliSense). For me, the way WinForms works is way better than WPF, but of course, WPF is more powerful in many ways but that's not what I'm talking about.

    Of course you have to remember. Intellisense helps you type and I never said you had to type everything letter by letter, what I mean was that, for intellisense to help you, you need at least to know the letter by which the tag you want starts, otherwise, it won't help you. Or you are going to waste your time reading the description for every intellisense item that pops up? I love intellisense, I honestly do and it's a great tool to any coder, but that doesn't invalidate the fact that we should have better design tools/capabilities. I shouldn't be forced to do all my UI in XAML code I don't really want it, why can't I have a good designer tool to help me out? I prefer that... And the things that I pointed in my first post, is things that should have been there in the first place and they wouldn't change a thing for people that prefer to do it by code. People that like that way, would still like that way and keep doing it that way. They are just pushing the thing about "developer is not the designer" which I dislike because I like to code and I like to design. I know they have Expression Blend, but that's a separate package which costs more money. Like someone said before, they could have at least implemented the Blend features into the Pro version of VS and not the others. Or maybe bundle Blend with VS Pro. Heck, I would be glad if only a few things (like I stated in my first post) were implemented.

    It will get better over time? On thing I really dislike in Microsoft is how thei update their products. We probably won't see any UI improvements in the IDE until the next release of VS. Since the early days of VS2003 RTM until VS2005 RTM, I never saw a single update that would change something like the properties window UI (to give an example). But maybe I'll be wrong...
    Saturday, November 24, 2007 5:12 AM
  • Blend is included with MSDNAA - check out http://msdn2.microsoft.com/en-us/academic/bb676724.aspx#3 to confirm.

     

    You may just need to contact the MSDNAA at your school to request that they provide access to it.

     

    -Robert

    Monday, November 26, 2007 9:02 PM
  • This is a great post.  Let me see if I can break it down into categories of issues:

    1. The rendering of text in WPF doesn't look as good on your system as the text that is rendered in Windows Forms.
    2. WPF's class hierarchy is based heavily on composition and this will take some getting used to.
    3. Features you expect are missing from both the properties window and the designer.

    I can't speak much for the text quality of WPF.  I think this could be system dependent and perhaps even monitor dependent.  Clear Type needs to know how the sub-pixels on your monitor are arranged and maybe there is a bug in the WPF Clear Type renderer that is getting this wrong on your system. 

     

    The WPF class hierarchy is different from Windows Forms.  It is much more factored and flexible but it will take some getting used to.  Keep using it and I think you'll end up really liking it.  We chose Grid because it allows you to position elements in standard X-Y coordinates while easily allowing for automatic stretching of content.  Canvas is the most like Windows Forms but does not have any of the anchor or docking characteristics of Windows Forms.  If we started with Canvas you would have to switch to a different panel if you wanted dynamic layout.  Instead, we started with Grid and added a lot of design time logic to make it feel like a canvas.  The goal was to give you the ability to just lay things out by dragging them, and then grow your design into a fully dynamic layout as needed.

     

    If you do have your images setup as resources, you should actually see them in a drop down picker for the Source property of an Image control.  If you're not, you may have some sort of installation problem.  I would be interested to know if other people are having similar issues with the RTM bits.

     

    When we started writing the designer our original goal was to create a designer with enough richness that you'd never have to drop to XAML.  It didn't take long to realize that goal was unreachable if we were to make a 2008 date.  Once we realized people were going to spend a lot of time in XAML we found it necessary to change the feature set.  XAML features like high quality Intellisense became much more important, and the need to do features like this on the XAML side eroded the time we had to implement features in the designer and properties window.  Both the designer and properties window are coded from the ground up to have an extensibility model that can support very rich features.  We're not making the best use of that ability today, and we know it.  What you're seeing is a very solid foundation of a tool that will evolve over time, with a set of features designed to improve a coding experience that involves frequent XAML editing.

    Monday, November 26, 2007 9:23 PM
  • Hi

     

    I'm a Program Manager on the WPF designer team for Visual Studio 2008. Thanks for taking the time to get hold of the RTM version and give us your feedback.

     

    I'll provide responses to a couple of your questions - I've forwarded your comments to some colleagues who will respond on the other points soon.

     

    Points 1 & 2 - other colleagues will respond to these

     

    Point 3 Expression Blend and Visual Studio 2008 WPF designer:

    In Visual Studio 2008, which delivered our v1 WPF designer, we focussed primarily on giving a good experience for the XAML-focused developer because we believe many early-adopter WPF developers will work this way. This is why you get strong type-based XAML Intellisense support, document outline and path controls to help you find your way around the solution, ability to select using the design surface and see the related XAML selected, etc). Expression Blend's first release is focused on providing designer support for the Design-oriented tasks which need to be performed when building a WPF application (re-styling, animation etc).  For MSDN subscribers, Expression Blend is a part of the included set of tools (see http://msdn2.microsoft.com/en-us/subscriptions/aa718657.aspx for details), and the two tools work on a common project file system. You can consume styles that have been built in Expression Blend using Visual Studio 2008, via XAML editing, and the Visual Studio design surface will provide a preview of those resources being applied.

     

    Point 4:

    The Grid is the most flexible layout container in the WPF vocabulary, and we believe many applications will use it as their main layout control because of this. As others have mentioned, Window, UserControl and other top level containers don't provide any layout capabilities, so we wanted to make it possible for you to get started on laying out your WPF applications without having to understand all of WPF layout from scratch; with these thoughts in mind we added a Grid control to the default project templates so you'd always have the most common layout control in place when you created a project.  We also built a Grid design time experience which allows you to add and manipulate grid rows and columns on the design surface, and snap controls to the grid lines if you wish to.

     

    With all that said, you can very easily remove the Grid (using the design surface you just click on it and hit delete), and add other containers (drag on a DockPanel, StackPanel, Canvas etc to your own preference) if you would rather use other layout approaches.

     

    By the way, the WPF designer in Visual Studio 2008 has it's own forum for feedback, which you can find over at http://forums.microsoft.com/msdn/showforum.aspx?forumid=169&siteid=1

     

    Thanks again for your feedback,

     

    Mark Wilson-Thomas

    Program Manager, WPF Designer, Visual Studio 2008

    Monday, November 26, 2007 9:26 PM
  • Regarding WPF's text --

    • WPF does indeed have its own cleartype font rendering stack
    • WPF does follow the OS' cleartype font rendering settings which are set by the cleartype tuning power toy, so you should definitely try that out and see if it improves your text quality.
    • GDI's cleartype, like WPF's, makes use of the fact that LCD pixels are usually three vertical rectangular sub-pixels (one each for R, G, and B) and that the color ordering is usually the same.  Doing this conceptually triples the horizontal resolution of the display.
    • WPF's cleartype is fundamentally different from that of GDI's in that GDI always snaps each glyph to both vertical and horizontal pixel boundaries.  By doing this, GDI achieves higher glyph contrast at the expense of horizontal glyph alighnment.  To see this in action, open Word and type a series of 'l' characters in a variety of fonts: llllllllllllllllllllllll  -- each l looks the same, but the spacing is erratic.  This is especially noticeable with smaller fonts. (~8 pt)
    • WPF does not pixel-snap glyphs horizontally.  By allowing glyphs to begin on sub-pixel boundaries, WPF positions glyphs much more accurately than GDI, but at the expense of some glyph contrast.  Repeat the previous experiment in a WPF app, like xamlpad.  Note that the 'l' spacing is unfiorm, but the 'l's don't all look the same.
    • We (the WPF team) realize that not everyone prioritizes glyph position over glyph contrast, and we're currently investigating changes that could allow more control here.
    • As always, I can't promise anything, but we definitely do know there has been some mixed sentiment about the way fonts are rendered.

    Thanks!
    David

    Monday, November 26, 2007 9:43 PM
  • Nice to be answered by guys at Microsoft that developed Visual Studio 2008. I think everyone already answered my all questions... I'm still a bit confused by the text rendering thing and I honestly dislike the way I see fonts in WPF. I don't understand much of what you said about the lcds, pixels and stuff, but I care most at what I see, and for me, fonts rendered by windows cleartype look much better.

    About blender, I'll wait a bit and see if it gets available for download from the e-academy website.
    Tuesday, November 27, 2007 12:34 AM
  • You bring up some good points especially about the little help text that's missing now.  Haven't encountered the font rendering issue though.  The reality is that you really do need to use both blend and vs if you going to make a full blown wpf app which seems like a hack to me having to have 2 apps open at once and having to alt tab between the two.  Blend makes working with animation, colors and templates much easier than it is in VS, but Blend's text editor is not much better than notepad and certainly pales in comparison to the autocomplete richness of VS's editor.  Don't really get why VS just didn't take the code from the designer interface of blend and/or Blend didn't take the editor code from VS.  It seems inefficient to me to have two design teams working at one company working to accomplish the same goal, develop a rich wpf development experience, yet not share that code.  If the idea is to sell two products then fine but I wish there was an option to replace the Cider design interface with Blend's if you have a Blend license or get the autocomplete features of VS into Blend if you have a VS license.  This having to use two apps to get your job done is for the birds but in all fairness if you want to "pretty up" your winform app you would most likely have to use some type of additional design tool to get anything close to approaching what you can do with wpf quite easily.  Hopefully in the future we will get an app that appeals to those of us who wear 2 hats of a designer and a developer, but my hats off to the team for getting as far they have in such a small amount of time. 

    Tuesday, November 27, 2007 2:41 AM
  • I still can't get the Image source to work though... I opened the file Resources.resx and then I clicked the dropdown button to load an existing image. This image is not found in the Image.Source property dropdown menu. What's wrong?
    Tuesday, November 27, 2007 1:59 PM
  • Try this.  In windows explorer, drag and drop you image files to a folder in your project in the "Solution Explorer" within visual studio.  Once the image is in there, you will see it in the drop down of the property window.

     

     

    Tuesday, November 27, 2007 2:28 PM
  • I've just tried the final RTM version of the WPF designer, and I still cannot confirm that you're targeting XAML-oriented development with it ;-)

     

    My greatest concern is about trash properties. I mean, as you drop controls to a container, the designer would add certain properties, at its own discretion, that break the layout.

     

    Scenario 1: I replace the default grid with a stack panel, drop there a button and a checkbox. I set their alignment to center. They would not center, though. Why is that? It's because there're the unwanted Width and Height properties I have never set. They're about to break my size-to-content behavior of the panel.

     

    Scenario 2: You prepare grid rows and colums to lay out the controls on the window. Then you start dropping controls into the cells. Instead of spanning the whole cell, as is for the default grid child behavior, they get their weird width/height settings and some completely crazy Margin values. Hence randomly scattered controls instead of the neat grid-based layout. Why so?

     

    Using the designer, you have to clean up those all the time from your controls. On the other hand, the designer would not help with any useful properties, like Margin=5 around the buttons in a stack, for example.

     

    Is there any setting to alter the designer behavior?

    Tuesday, November 27, 2007 6:37 PM
  • That worked... But doesn't that render the resources.resx file to be useless? I mean, I can still add files to the resources file, but if I want to see them in the Image Source dropdown, I have to set them as "Resource". Shouldn't that be done automatically?

    By the way, what if I want to change the image source dinamically at run time, how do I do it?
    Tuesday, November 27, 2007 9:43 PM
  • Hi hypersw;

     

    you make an interesting point about emitting "trash properties"; i.e. the fact that when we place a new control instance on the design surface we give it a width and height, and margins so that it stays where you drop it and sizes to a reasonable default size.

     

    The story of “why we spit margins to make things feel like anchored controls in Windows Forms” by default in the Cider layout system is basically about making it possible to traverse two paths to your final layout, and to cross over from one to the other:

     

    1.   The old-fashioned “Place-and-size” path that people have been used to on every GUI designer that's shipped since Visual Basic.

    2.   The “Container first” path, where you lay out the Grid(s) or other containers that will govern the layout, then place controls inside them (generally with zero margin) and let the container take care of the resize behaviour

     

    Path 2 is really the kind of approach you’re advocating in your post. Both from a platform-purist point of view and a Web UI developers point of view, I agree this a clear and straightforward way of thinking about layout in WPF. However if you’re one of the many millions of devs who have been working with Windows Forms, VB, etc etc for years, and have never done a web app in your life, it will not be an easy transition for you to be forced to start thinking this way for your first app building experiences – and in the end you may never want to build a resizable app. So if you’re a developer with that set of experience, what we let you do is get a pretty much functional WPF app in the traditional way you always have (and actually for a lot of applications you might even stop there). But if you wish to, we give you help to start dropping gridlines into your design and snapping them to your controls/your controls to them (getting the zero margins you are looking for) ready to move into Auto-layout-land. Unfortunately, we didn’t have time on Cider v1  to deliver the features that would give you the “flip-to-auto” part of the story on the design surface, so you have to go to XAML or the property inspector to make it happen, and when you do the behaviour of the design surface can become a little “quirky” in places.

     

    The application layout path that works best right now in the tools if you want to use the design surface is:

     

    1.       Place your controls and get them roughly where you want them

    2.       Drop gridlines to control resize behaviour but don’t flip to Auto sizing yet

    3.       Snap your controls to the gridlines to zero out margins where that’s what you want (or multiselect in the property inspector and zero margins on the whole set of selected controls)

    4.       When everything’s done, flip to auto using XAML or the PI. If you need to move/resize things after that it’s best to flip back out of auto first.

     

    (Note that steps 1 & 2 are pretty much interchangeable)

     

    I think it's reasonable of you to argue we should have started with a mode that favoured auto layouts (rather than the method we have used), but after discussions in the team we felt this kind of total break with the past would be just too jarring for too many existing UI technology users.  I do take your point that a designer setting that allowed you to have a more "start with auto" approach would be a useful feature, and we'll think about that for future releases.

     

    As an aside, right now one way to work in a "start with auto" approach is to work entirely in the XAML editor, and not use the toolbox for control creation at all. That way you will get only the properties you explicitly wanted at creation time.

     

    Hope that helps,

     

    Mark

    Tuesday, November 27, 2007 11:41 PM
  • I don't like people taking over my topic and everyone forgetting answering me Sad
    Wednesday, November 28, 2007 12:03 AM
  • Is there ay way to get WPF to stop using ClearType? That is, to just render text normally? Don't care for ClearType or the Tuner.
    Monday, May 04, 2009 10:41 PM
  • You can explicitly set a couple of properties to get rid of blur effects:

    TextOptions.TextFormattingMode="Display"

    and / or

    TextOptions.TextRenderingMode="Aliased"

    These properties can be set for textblocks and other objects in the WPF XAML code. Have a look at:

    http://blogs.msdn.com/b/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx

    ... for more information about these settings.

    Now looking for a way to set this globally, so if anyone knows, please share.

     

    Tuesday, May 03, 2011 3:14 PM