[Comprehensive unblocking! Real expression blend practical development skills] Chapter 9 fluidmovebehavior completely resolves the scroll bar of the second smooth motion

Source: Internet
Author: User

This chapter explains another application of fluidmovebehavior. This is an absolutely original practice. It has already been included in silverlight.net by Microsoft. The author is the roasted sweet potato myself ^. This idea is from a foreign friend of silverlight.net who asked questions in the Forum. He mentioned in his post that he often saw a lot of ListBox in flash. When dragging the scroll bar, the elements in the box are always moving smoothly, rather than jumping to the front. I don't know if Silverlight can achieve this effect. This post had a high click rate at that time, and everyone was enthusiastic about the ideas. Most people tend to rewrite them on their own. Some people give back their specific ideas and create N classes, ranging from inheritance to interfaces with hundreds of lines.Code. But in the end, my reply became the best answer, because I told him that he didn't need to write a line of code. To achieve this effect, you only need 30 seconds.

First, create a new project, add a ListBox, set its width to 100, its height to 200, its left alignment, and its top alignment. Then, add 20 listboxitems to it, as shown in:

Next, right-click ListBox and choose edit template>Edit a copy

In the pop-up panel, select a name and click OK. Enter the listboxtemplate editing mode. FindItemspresenterElement and select it.

In the assets panel, find fluidmovebehavior. You can double-click it and append itItemspresenterYou can also drag himItemspresenter.

Then exit the listboxtemplate editing mode, right-click ListBox again, and select edit additional templates-> edit layout of items-> creaye empty in the pop-up menu, in the pop-up menu, select a name and click OK.

Click F5 to runProgramAnd then drag the scroll bar. Now you can see that the listboxitem can smoothly move up and down.

Source code download

The story behind it:

In the last step, edit additional templates-> edit layout of items-> creaye empty. We created this template, but there was no operation. But it is indeed the core step to achieve this effect. The ListBox container template is exposed in XAML.

next I will explain how to make the elements in the ListBox fly out of The ListBox. You can see this effect in www.kaodigua.net. if you like my Article , click "recommendation" in the lower-right corner of the Article. Thank you.

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.