Time for a brief but fun post... some time back Tim Heuer posted the Silverlight 3 bouncing plane gratuitous demo. Click an element,and the nearest corner would bounce backwards and forwards as it comes back to rest.
Tim had the code to setup the storyboards,and handle the mouse interaction in code-behind. I look at it,and immediately see a reusable component (even if it is a gratuitous one),or more specifically a behavior,that encapsulates all the logic,and can be attached declaratively in XAML to one or more elements simply without needing any code-behind logic. So I created one such behavior. I used this behavior in my TwitterBug sample at TechEd recently,and thought it Could use a dedicated blog post. :-)
Here is a screenshot,which really doesn’t do much justice to something interactive. So go ahead,and click it to run the sample live. Click around on the images. And if you’re wondering how its done,go ahead and download the code. You’ll see a BouncingPlane class that derives from Behavior......
详细查看......
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。