Need a soft/virtual keyboard on your Silverlight application? Check this out Virtual Input Keyboard & Behaviours for Silverlight by Orktane. Thanks to the author’s tremendous effort, the fully functional soft keyboard is supported in both Silverlight 3 and Silverlight 4.
Posted by yeejie
4/25/2010 4:03 PM |
I disabled commenting in my blog due to uncontrollable spams. However, thanks to Michael Ceranski, I just added captcha feature. Refer to his blog post for detailed steps on how to implement captcha for blogengine’s blogs.
For the past two weeks, I developed a prototype of Kiosk application using Silverlight 4. As Siverlight 4 is just newly released, I believe by sharing my experience as following will benefit the others. Let’s have a look into a few screenshots of the Kiosk application:
Check out and view orders page:
Payment page which leads to printing of confirmation receipt:
That’s all! Looks simple, however the implementation is not so easy. Let’s go through the implementation process in Problem/Solution format:
Problem #1: Design…Design….Design
"I can’t design. I’ not talented. The crappy design tool doesn’t work like what I expected". If you got the same experience, welcome to my “I hate design” club.
Solution: You just have to live with it
You do not need great design skill in order to design UI of Silverlight application. The only tool you will use and play with is Expression Blend (provided you have all the necessary graphic elements). Download "Getting Started: Create Silverlight Experiences with Expression Blend 3 Course" provided by Microsoft. Study and go through the tutorial examples. I assure you that even a developer can design a great UI using Expression Blend :).
Problem #2: Storing data in Silverlight
"I need to store and retrieve data in my Silverlight application. What are the possible ways?". From my experience, you can either 1) use XML for simple data storing 2) use sql database, access database using WCF RIA service. In my prototype, I was leveraging on XML to store data, thus I will not cover the latter way in this post.
Solution: Design XML. Use LINQ to XML for CRUD in your Silverlight application Problem #3: Dealing with listbox
First, design your XML. XML is W3C standard. A lot of tutorials are out there to teach you how to design it. You can use Xmlreader/Xmlwriter to read/write XML, but my advise is to use LINQ to XML. Refer to this tutorial post on how to use LINQ to XML in Silverlight: "Using LINQ to XML in Silverlight 2" by Martin Mihaylov.
Adding and removing items into/from listbox control is fairly simple. It can be done by using listbox1.Items.Add() and listbox1.Items.Remove() command respectively in your code. However, this may not be the best way if the listbox holds custom listboxitem.
Solution: Data binding Problem #4: Passing data/information across pages
Data binding is the right way to go. In my prototype, the Order listbox is data bind with a class. Refer to DataBinding & DataTemplates Using Expression Blend for detailed implementation.
Passing data and information from initial page to the next page always appears to be a challenge to developers. There are a few ways to achieve it: 1) use static class 2) leverage on navigation framework, URI mapper and parameter 3) assign data/information to any parent page’s element tag and retrieve it from child page.
Solution: Choose the best fit Problem #5: Out of Browser (OOB)
In my prototype implementation, I use static class to store data and passing it across the page. For parameterized information, I assign it to the parent page’s contentframe tag (my Silverlight project template is navigation application) and retrieve the information from my child page. The reason I’m not using the navigation URI method is due to parameter value can only be retrieved in the OnNavigatedTo() event. Therefore, if you need the parameter value in constructor event to initiate the page, navigation URI method is not appropriate.
My prototype needs to be deployed locally without hosting it in a web server.
Solution: Understand OOB
Check out Silverlight 3 OutOfBrowser(OOB) behind the scenes Explained for detailed explanation of how OOB works and the way to package and deploy your xap locally. However, please keep in mind that the method only works for deploying Silverlight application which without elevated permission. Elevated permission is a new feature in Silverlight 4, in shorts, it needs to be stored in Isolated Storage folder in order to run in elevated permission mode.
"Is there any simple way to deploy Silverlight application? Probably to an exe file…like flash application?". YES! Desklighter provides us the tool to create standalone windows application from Silverlight XAP file. Just a few clicks and it works like a charm. Million thanks to Desklighter for saving my time from writing deployment instructions. Problem #6: Printing with non-windows driver printer
If you develop kiosk or POS application before, you probably know that the printer used by kiosk or POS application doesn’t have a window-based driver. Generally the printer we use is called OPOS, or I call it com-based printer.
Solution: COM Interop (only in Silverlight 4)
Consider upgrading your solution to Silverlight 4 because only Silverlight 4 provides COM Interop feature. First, you need to register (regsvr32) the DLL/OCX you intend to call from your Silverlight application. Next, use the code example as shown as here to refer and call the COM component. I will follow up with the implementation of COM interop with OPOS printer in the next post.
Undoubtfully, Silverlight 4 has created a big buzz among .Net developers recently. In this post, I’m sharing a cool demo site that is created by Sina.com. Basically it’s a stock monitoring site. By developing with Silverlight 4, the site (which is now a full-fledged Silverlight application) gives a wonderful experience to the users (both technical and non-technicaL). Check the site out and you will understand the excitement:
Oh yeah…first and foremost, install Silverlight 4 RC, available at http://bit.ly/ddN6gK.