tailieunhanh - Foundation Silverlight 3 Animation- P6
Foundation Silverlight 3 Animation- P6: Silverlight has really come a long way since I started using it. It’s kind of interesting to look back a mere two years (roughly) and think about how the workflow has changed. Of even more interest is the staggering speed at which new features are being added. In the time I’ve been using Silverlight, it has grown from a somewhat limited toolset to an ever-more-impressive technology that has really started to come into its own. | ANIMATION TECHNIQUES 12. Selecting a control from the Asset Library will add an icon to the toolbox that you can use to add the control to your project. Select the RectangleControl object from the asset list. Once the icon shows up in the toolbox double-click it. A new 200X200 blue rectangle will be added to the artboard. This turns into a lot of fun when the controls are added programmatically because each instance of a control exists in its own space and can have its own color size and so on. 13. On the Project tab right-click and select Edit in Visual Studio from the pop-up menu. In Visual Studio we ll add an instance of this custom control in the same place as variables just above the MainPage constructor. Each instance that we create is a copy of the original object but each copy has its own set of unique properties. Once an object instance has been declared it is available for use in the application. To make it visible within the application it must be added to the LayoutRoot Canvas. This is done by calling the Add method for . 14. Just above the MainPage constructor add the following code to declare an instance of the Rectangle object RectangleControl MyRect new RectangleControl 15. To add the user control to the LayoutRoot Canvas add the following code inside the MainPage constructor just after the InitializeComponent line MyRect Now the rectangle will be displayed on the canvas when the project runs. 16. A second instance is equally simple to add create an object called GreenRect and add it to the canvas. 17. This time we ll add a little code to modify the object a bit. Because we named the elements that make up the user control they are easy to access from code by referencing the object name and then the member name. In the case of GreenRect we want to place the rectangle at 400 200. To do this add some code before the rectangle is added to the canvas
đang nạp các trang xem trước