Silverlight Survey Application Control

29. June 2009

Ok so this is a very simple Silverlight 2 voting control that I worked on to learn how to do a few things in Silverlight.  I will be making a Silverlight 3 version once it is officially released.  I guess some would call this a silverlight polling control as well.  I don't know, I'm calling it a voting control.  So here is what it was designed in:

  • Silverlight 2.0
  • ASP.NET 3.5 site hosting the Silverlight control
  • Visual Studio 2008


Here are the concepts involved in the control:

  • Read an XML file via the WebClient using the OpenReadAsync method
  • Write an XML file via the WebClient using the UploadStringAsync method
  • LINQ to XML
  • The Charting Control using the Bar Series.


Here are some notes about the control.

  • It is not very fancy so please style it how you please.  I personally took out the legend on the BarSeries because it allows for more room.  
  • It does not have any sort of management interface to edit the XML file.
  • Give the PollData directory in the Web Project write access
  • fileUploader.ashx in the Web Project handles writing the file back to PollData (could use some more error catching
  • Dimensions are 350 x 345
  • FileUri and FileUploaderUri paths are in the App.xaml
  • The XML file contains the question and title as part of the root attributes


Here are some screenshots of what it looks like





The full source code is attached so feel free to do whatever it is you like.  

Source Code

TestSLSurveyPoll.zip (1.16 mb)

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Silverlight

Comments

Enoch
7/2/2009 9:28:13 PM #
Pretty cool.
raymond
8/8/2009 9:59:19 AM #
hi...the option 1 and 2 and so on not showing out ???
raymond
8/8/2009 10:16:49 AM #
hmm...nth showing up?
John M
8/9/2009 6:30:29 PM #
Raymond.  Interesting.  The XML file must contain data for the chart to work properly. Try just putting in fake data and see how it goes.
raymond
8/10/2009 6:49:08 AM #
yaya...the XML oledi contains the <option>This is option 1</option> ...
So am i just change the wordings inside?

if possible can i have the full source with sample data inside? pls...

raymond2008@hotmail.com

Thanks!
8/10/2009 4:50:52 PM #
Raymond, the full source code with sample data is in the link above in the blog post.  This has everything you need to modify and test.  This was written in Silverlight 2.
Raymond
8/11/2009 5:04:22 PM #
Tats Weird...for me, when i run the solution file, it does not show me the options inside to vote..and the count is 999999, and the graph doesn't show up..
8/11/2009 9:29:43 PM #
Ok Raymond I should have some time tonight or tomorrow and I'll see what's going on with this for you.  I'll email you at the above email you left.  Thanks! - John
Raymond
8/11/2009 9:51:22 PM #
Thank you very much....Smile Im looking forward for a positive  result.

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading