Charles Petzold Talks About Silverlight Applications and Windows Phone 7

The various aspects--good and bad--of porting Silveright apps to Windows Phone 7

Editor’s note: Welcome to .NETRocks Conversations, excerpts of conversations from the .NET Rocks! weekly Internet audio talk show. Hosts Richard Campbell and Carl Franklin chat with a wide variety of .NET developer experts. This month's excerpt is from show #594, with guest Charles Petzold, a well-known author of technical books for Windows developers.

Charles Petzold: So what are you guys detecting as the buzz around Windows Phone 7.0? Is there really a lot of developer excitement about it, or is it, as they say, too little too late?

Carl Franklin: Oh, I don't think it's too late. I think it is too early. Everybody has got a wait-and-see attitude. People I know who are writing apps in the emulators seem to like it.

CP: It's been very interesting to me to watch how what was originally the WPF framework has kind of evolved and moved into different areas with Silverlight and now on the phone. Basically, we don't have a single framework for all three platforms.

Richard Campbell: No. They're all a little different, aren't they?

CP: Yeah. I mean, the big difference is between WPF and Silverlight, of course. And then Silverlight for Windows Phone is basically Silverlight 3.0 with some other stuff thrown in there, and it's missing some pieces you would expect it to miss. Like drag and drop doesn't make a whole lot of sense out of a multi-touch display. But at least these three frameworks have more than just a familiar resemblance. You know, you can actually obviously leverage your programming skills. If you know Silverlight, you can jump right into the phone and start doing things.

RC: For sure. Let's face it, none of them are Objective-C.

CP: Oh, yes, yes, yes, yes.

CF: Thank God.

RC: Yeah. That's a far bigger element here; it's the distinct lack of Objective-C.

CF: We have a twit from JasPO. Any news on the HTML 5.0 capabilities on the Windows Phone 7.0 browser? Is it the same browser as \\[Windows Mobile\\] 6.5?

CP: That I do not know. My understanding is that the browser on the phone was not going to be HTML 5.0 capable. How can it be really, initially?

RC: At least for the initial release.

CP: Obviously HTML 5.0 is going to have a major impact on us all, but it's going to be slow, I think.... I think the phone is at this point really for Silverlight and XNA apps, even though you can do, you know, even though they're advertising the two platforms as Silverlight and XNA. Because Silverlight can communicate with JavaScript on a browser page, you actually can do phone apps in JavaScript.

RC: Right.

CF: Yeah.

RC: I don't know that you should.

CP: No, no. I don't think you should at all. But some people may have a ton of JavaScript that works, and nobody knows exactly how, so they can't port it to some reasonable language… and you can maybe get that to work on the phone.

RC: Because the reality is with the Windows Phone 7.0 it's not very likely that Microsoft will license Apple's HTML 5.0 mobile engine like they have put into the iPhone and obviously other devices. So Microsoft is going to have to build their own HTML 5.0 engine to run in the phone, and of course the IE9 team seems like they're hard at work at it, and that might end up imported.

CP: Yeah, yeah.

RC: But I can't imagine it making the first version, nor does it need to.

CP: Right.

CF: Yeah. Well, it's going to be interesting. Like I said, I think most people are holding their breath and waiting until they can get their hands on them. Although, you know, like I said I've seen some great demos and some very excited people, but nobody will really know until—I think the excitement will come when they hit the streets.

RC: We have a technology enthusiast right now. We don't have a business owner enthusiast—like where the business owner is looking at HTML 5.0 and saying this is going to be a huge win for me and we've got to start rolling out our apps that way.

CF: So what do you think about the Windows Phone 7.0 and the emulator and all that?

CP: I'm really excited about it because I have a lot of WPF and Silverlight programming skills, so I'm looking forward to writing a bunch of apps that only I can use. But I've been kind of frustrated when I've done some blog post about Windows Phone 7.0 programming and there doesn't seem to be any response or interest to something like that, and it's kind of scary. I'm not really connected to get a lot of developer buzz usually, so it's hard for me to know what other programmers are thinking about, but I'm enjoying it. I think that once people realize how easy it will be to take that app that they've done for Silverlight and move it to the phone, it's going to be exciting.

CF: How easy will it be?

CP: If you're using a lot of standard controls, buttons, and sliders and list boxes, putting those on the phone and having them respond to multi-touch will be trivial.

RC: No big deal at all.

CP: Yeah. And look at the size of the screen, too. It's 640 × 480. One of the interesting things will be the actual sizing of your fonts and stuff so they're readable because even though it's an enormous screen, it's 480 × 800.

RC: Right. It is an enormous screen for it, but it's physically a small screen.

CP: A small screen. Whereas on a conventional desktop machine, you have a pixel density of about 100 dpi.

RC: Right.

CP: On the phone, it's going to be more like 200 dpi. OK, so all your fonts should be a little bigger just so they're readable. So that's going to take a lot of fine tuning. Now what they've done is define a bunch of XAML resources for font sizes and text blocks, so that you can pick one of these and assume that it's going to be reasonable.

RC: So the interesting challenge around this is going to be, have you made your app in such a way that you've got a clear separation of concerns? The bulk of the functionality wrap is going to be identical between a PC implementation and phone implementation. Just the UI elements can be changed in such a way that you can read it on the phone.

CP: Yeah.

RC: I don't know that we've… this is a new challenge for Silverlight. We haven't exercised that part of Silverlight.

CP: Exactly. It's like one of the nice things about WPF is the concept of the Device Independent Unit.

RC: Right.

CP: What some people called the Device Independent Pixel, where you're always drawing in units of 1/96 of an inch and you're specifying your fonts in that size as well, so that if this was WPF you'd put it on the phone and everything would size correctly.

RC: Right.

CP: You can read it. In Silverlight, though, we're working in pixels.

RC: I think that's an interesting distinction, Charles, that hasn't been made before. It's that this is one of the things that WPF does better than Silverlight.

CP: Oh, absolutely. Yeah.

RC: Very interesting. Actually WPF is better suited for the phone than Silverlight is because of this concept of working in 1/96 of an inch.

CP: Yeah.

CF: JasPO says on the Twitter, "A colleague recently did a talk on Windows Phone 7.0 at Workstream People. When he said there was no Silverlight support in browser, groans all around."

CP: Yeah, yeah.

CF: In other words, the browser can't browse to a Silverlight site even though the browser is Silverlight.

CP: Yeah.

RC: And as Daniel Egan said yesterday, "And you can implement a browser in Silverlight in the phone."

CP: Right, right.

RC: You can't implement Silverlight in the browser.

CF: Yeah.

CP: Yeah. Don't we expect this limitation?

CF: Sort of, yeah.

CP: I was not that surprised.

CF: It's just we want everything and we want it now. Yeah, I think that's basically it. But yeah, I mean if you think about all the things that you need to be able to support the full Silverlight framework...

CP: Uh-hmm.

CF: You know, since it's not the full Silverlight framework on the phone, therein lies the rub.

There's much more: Listen to or read the full interview here.

Richard Campbell and Carl Franklin (both Microsoft Regional Directors) are the voices and brains behind .NET Rocks! ( They interview experts to bring you insights into .NET technology and the state of software development. They’re more than dry technical interviewers—they have fun!

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.