Tuesday, April 15, 2008

Best Company in the World, Part 2

In Part 1 you will remember that I was telling you that Microsoft was a great company because they actually answered my question. That was nothing. Anybody can answer your question when you ask one.

This time they did one better. They answered me when I didn't even ask the question. In my post last night I was grousing about Cider and how I couldn't drag a control onto a form. I did not do what a normal programmer would do and search the Microsoft forums to see if there was an answer to this problem. I just kinda sat there and bawled.

But Microsoft was not content with that. They sought me out and fixed my problem despite my own infantile attitude. Two separate Microsoft employees posted comments on my blog. One was a member of the WPF & Xaml Language Team, and the other was the lead developer on the WPF Designer (Cider). You can read their comments yourself on my previous post. Rob Relyea and Marco Goertz.

Now I want to know how they found the post so quickly. The Google bots would have to be awfully quick to pick it up so soon. No, I have to believe that my blog is required reading for all Microsoft employees. I'm on all their RSS aggregators. Bill Gates asks about me every morning. He says, "Well, how's Bill doing this morning. I mean the other Bill."

So clearly I'm going to have to raise the bar here. Next problem I have, I'm not even going to blog it. I'll just close my eyes and think real hard and see if I get an E-mail from Microsoft the next day. Course, that's not nearly as much fun as moaning on my blog.

Monday, April 14, 2008

Cider, But You Can't

Well, to compensate for the long period before the prior post, I am now griping about the WPF designer. The documentation says:


How To: Add Controls to a WPF Window
  • In the WPF Designer, drag a control from the Toolbox to the design surface.

    -or-

  • In the Toolbox, double-click the desired control.


So I tried it. It does not work. All actions are ignored. When dragging, you get the international "Not allowed here" sign as the cursor moves over the destination form.

Now, as I have probably said countless times already on this blog, it is undoubtedly possible to do what the documentation says you can do. Only why can't I do it? Because the X bit has not been set, because the Draggable check box has not been checked, because I am using a type-A project in a type-B solution on a type-C operating system, and, heck, everybody knows you can't do that. There's no reason for an error message, because everybody knows you can't do that.

The problem is, I don't know that. Whatever it is. Whatever it is, no matter how thoroughly Microsoft has documented it, I can't find the documentation if all I see is a slashed circle. In Windows Forms I never, ever, tried to drag a control onto a form and saw nothing but a slashed circle with no hint, no inkling, no slightest clue, as to what the problem was. I am not comparing this to a Linux product or an IBM product or an HP product or a Sun Microsystems product. I am comparing this to a Microsoft product: Windows Forms. Why do we regress? Why is the new, improved, WPF environment so much worse than before? This gives a whole new meaning to the word improved. Microsoft has now defined the term "improved" as "worse."

Renaming Xaml Files

Okay, the record now is 343 days between posts. Still holding at under a year between posts, but rising. If somebody would please post a comment to encourage more posts,... that wouldn't help, because I only log in to make new posts. Hmmm....

I got a free copy of Visual Studio 2008, Standard Edition, from Microsoft for attending the launch ceremony in San Francisco on March 13. I am sad that they did not give me the Professional Edition, as they did in 2005. But free is free, right?

Now I am using said product, and I have found a bloggable issue here.

The issue is renaming the xaml file in a WPF application. I actually sent in a comment during the Beta period, and Microsoft replied that they were aware of the issue, but had decided not to fix it at this time. (We Ignore You, Puny Customer.)

So, anyway, you make a new WPF project in VS08, and the template kindly provides you with a Window1.xaml and a Window1.xaml.cs code-behind file. Of course, you want to rename that to a more meaningful name. Maybe you want it called DVDList.xaml and DVDList.xaml.cs. So what do you do, kids in the peanut gallery? You right-click the file in the Solution Explorer and select Rename from the context menu. This allows you to type a new name for the xaml file, and miraculously also renames the .cs file. Whoopee, so far so good.

Great! Press F6 and it all compiles without error or warning. Press F5 to run, and you get an IO Exception saying that Window1 is not found!

Huh? But didn't you just rename that? Ho, ho, no. This is not like the good-old Windows Forms application you're used to, where it runs a refactor, rename feature. No, no. This is the new, improved, WPF environment.

Improved, except that they've taken away the rename functionality!

What's the word for that? Disimproved? Unimproved. Worsened? Whatever it is, you had it before and they took it away!

So. What you have to do is a global rename. Typically, you hit ctrl+shift+H to get the replace-in-files dialog. Then change every instance of Window1 to DVDList in all files in the current project.

And for God's sake, don't let the FX cops find out you named it DVDList. They'll be all over your ass for that.

Labels: