Wednesday, May 4, 2011

New Silverlight Video Tutorial (10 minute): How to create a fake Winow Control that can be dragged, Expended and Collapsed


Hello All!
In Silveilght 4 there is no WindowControl..that is a Control that looks like a traditioanl Windows window. So, I made my own version, a Window control that can be dragged around, expanded and collapsed.  In this video I show how to do it with two simple Grids, one for Collapsed and one for Expand. I then use the Visual State Manager (VSM) to make it collaspe and expand.  Further I use the MouseDragElementBehavior Behavior to make both the collapsed and expanded windows draggable, just like a real window!  You can see the functioning demo on this Silverilght page:  http://tinyurl.com/456xsno
IMPORTANT: If you watch the video you will wee that after I drag, expand and collapse the window a few times I get a JavaScript error marked by an exclaimation point in the bottom left of the browser window.  Shawn Wildermuth speculates that it is because the Behavior get’s confused about who its parent object is.  The way I fixed it was to wrap the Expanded grid into another Grid and put the MouseDrageElementBehavior on the parent Grid. I don’t show how to do this in the video but it is in my source code (ie., the source code has no JavaScript errorrs).
Enjoy! Victor
PS: We have been growing the Los Angeles Silverilght Group (LASLUG – www.laslug.com) like crazy…for instance we gave away $2500 in gifts in our April meeting…in our next meeting we will be giving away over $12,000 in prizes all FREE to our members; we do not even charge for the Raffle tickets! So join us for pizza, refreshments, great presentations (Morten Neilsen and Josh Kales in May), plenty of Swag from our sponsors and all things Silverlight!
PSS: Our new prizes have been made possible from our new sponsors, Syncfusion, ComponentOne, Manning Books, O’Reilly Books, Nowcom, Telerik, the Windows Phone Dev Podcast, Jeff Levy (the Digital Doctor on KFWB 980 am – Sundays from 5-6pm) where I host a segment called “The Silverlight Corner” bi-monthly. 
To stay abreast of everything going on with LASLUG and get prizes you don’t need to live in the LA area..we often hold online prize give-aways and online meetings and soon all of our meetings will be streaming live.  So, if you live in Los Angeles or  Baton Rouge, LA you can be a LASLUG member by simply signing up for free at www.laslug.com
Victor!

1 Trackback or Pingback for this entry


No comments:

Post a Comment