Silverlight Annotation - Some more experiments
|
Being a data kind of gal, I really wanted to start saving the drawings I was creating in Silverlight into a database. So my next step with the Silverlight Ink tests I was doing was to enable website visitors to create a drawing and then save it on the site. Of course, to display the saved images, I wanted to create a carousel, but what I envisioned was different than the samples that were out there. So I went through a lot of experimentation and learned more and more about interacting with Silverlight as well as learning a more about working with AJAX than my previous "expertise" which was limited to using the UpdatePanel. This app is done using the Silverlight Beta1 javascript bits. This means that I have done a huge amount of javascript coding for this. That, combined with writing all of the web services in C# has helped me hone my C# coding skills to the extent that I am a little more nimble with the syntax. One of the bigger challenges was figuring out how to persist the images so that they could display in a smaller size. I started with the idea of just creating a whole series of inkPresenter elements in the carousel but I could not figure out how to resize them. After I came up with my solution, I learned from Microsoft's Stefan Wick that this would have been easy as pie using the InkPresenter's RenderTransform method. Instead I went down this crazy (yet educational) path of figuring out how to take the InkPresenter's XAML and convert it to a PNG image to save to the database. Again, because I didnt know all of the ins and outs of working with the WPF InkPresenter (which I leveraged on the server side) I went through a LOT of steps to do this, many which presented lots of roadblocks along the way. But I didn't give up and I was too proud to just ask someone how to do it, so I did finally make it work. Eventually, Stefan (who is on the Tablet PC team, and is a wizard with coding with Ink in WPF) showed me a much more efficient way, again using functionality that I just wasn't able to find even with hours of searching through documentation and on the web and everywhere I could look. In the long run, while Stefan was instrumental in helping me make a more sensible app, I learned an enormous amount of minutia about imaging in WPF that I may never touch again! I will be doing a presentation on this at DevConnections in the fall. In the meantime, I invite you to visit the site and test it out. |


