Silverlight3 simulates 3D pivoting

Source: Internet
Author: User
Tags silverlight

 

3D pivoting support in Silverlight allows developers to use 2D content to create 3D experiences. 3D pivoting is also a good way to make better use of the screen space. Let's take a look at how a simple graphic browsing application uses 3D pivoting to improve its appearance and make better use of its screen space. Different from displaying only one image at a time, we will display a major full-resolution image and other fluoroscopic images from different angles.

To perform 3D Projection on an image, you must set the Projection attribute of the image to PlaneProjection. PlaneProjection provides a set of attributes that make elements look like shapes in 3D spaces. Set the RotationY attribute to 70, that is, rotate the object 70 degrees along the Y axis or the vertical axis. This will make the rotated elements look perpendicular to the screen. Next, we need to move this element back and right to free up space for other images. To achieve this goal, we need to set the GlobalOffsetX and GlobalOffsetZ attributes. The inputs and events of 3D projection elements operate as expected. Therefore, the DataGrid or text box after 3D projection has the same functions as normal controls. We will continue and add the other 4 images and implement a slightly different perspective conversion to complete this procedure. You can set different GlobalOffsetX attribute values to move these images to the left or right.

This is the final result:

Data Binding Improvement
ElementName binding allows developers to bind one UIElement to another in XAML without writing an event handler. There is a new attribute named ElementName in the Binding class of Silverlight 3. When ElementName is set, the binding engine uses the specified element as the data source for binding. The Path attribute is the attribute of the data source bound to the UIElement. If ElementName points to DependencyProperty, the binding engine listens for changes to DependencyProperty and updates the binding accordingly. Here is a XAML snippet that shows how a slider uses ElementName binding to control the opacity of a central image:

The following page is displayed for the above XAML. Move the slider to change the image of the Blue Dragon from completely transparent to completely opaque:

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.