oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Building Photo Uploaders with XAML
Pages: 1, 2, 3

Trying It Out

With the PHP web site done, and the front- and backend of the Uploader written, it's time to give it a spin and see if it works. So, I press the F5 key to launch the debugger and I see something that looks like Figure 1-1.

Figure 1-1
Figure 1-1. The initial display of the Uploader

Next, I select the nice picture of yellow flowers and the C# code sets the image in the middle of the frame to the selected image. This is shown in Figure 1-2.

Figure 1-2
Figure 1-2. After selecting an image

What's kind of fun at this point is to resize the window; notice that the layout of the elements is preserved as the window is stretched. That's part of the advantage of using XAML and, in particular, the grid layout system. Moving on, I hit the Upload button and wait for the upload to complete. Then I browse to the index.php page on the site to see that the file has indeed been uploaded per my request as shown in Figure 1-3.

Figure 1-3
Figure 1-3. Viewing the uploaded image

There you have it, a rudimentary image uploader using some of the sexier features of XAML and the WinFX SDK. It's also a good demonstration of the Windows world playing nice with the open source world.


There has been a lot of talk about Windows Vista recently. Will it ship? When will it ship? What will be in it? I'm of the mind that it will ship, and from my experience with WPF (the Windows Presentation Foundation, which includes XAML) I'm sure Windows will ship as well, first and foremost because it's at the core of Vista. But secondly, because from the projects I've worked on I think it's solid, and the library design is good.

However, I do have one word of caution, and that is to watch out for old reference stuff. The WinFX SDK has gone through some changes. The class names have been altered, the attributes changed, and how the files are written has changed; you can see it when you Google for information on how to use a particular tag or class. Honestly, even on Microsoft sites there is legacy information from previous versions of the SDK. So, keep an eye out as you develop with this stuff and make sure that the code you are copying and pasting still works with the current version of the API.

That being said, I'm impressed with WPF and I think there is a lot of potential for engineers and graphic designers to take some of their interfaces to the next level with it.

Jack Herrington is an engineer, author and presenter who lives and works in the Bay Area. His mission is to expose his fellow engineers to new technologies. That covers a broad spectrum, from demonstrating programs that write other programs in the book Code Generation in Action. Providing techniques for building customer centered web sites in PHP Hacks. All the way writing a how-to on audio blogging called Podcasting Hacks.

Return to the Windows DevCenter.