Prism V2 Tour (4)

Source: Internet
Author: User

This article introduces you to a very useful feature attach Behavior in WPF. We call this additional behavior.

The popularity of additional behavior in the field of Web

If you know the ASP.net Ajax framework, you'll know the Ajax control Toolkit. While many of the features are flashy, this implementation is really worth learning. You can open the Web site of its display again and review its usage, as in the way of the following code

<asp:textbox id= "TextBox1" runat= "server"/> <sample:focusbehavior
"server" runat=
" FocusBehavior1 "
highlightcssclass=" myhighlight "
nohighlightcssclass=" mylowlight "
targetcontrolid=" TextBox1 "/>

Here are a few complaints, ajaxcontroltoolkit a simple feature that needs to rely on multiple base classes, light talk design is no problem, but it must be taken into account that we are doing the web, try not to load unnecessary script files, when you use their provided calendar extensions, You'll develop a script that's incredibly big. and features are not easy to expand. I've seen a few business controls, and it's also based on ASP.net Ajax. Because of object-oriented design, a control script can be loaded to around 300k. It's not that weird. Control developer or framework designer? I think or because of the characteristics of the web relationship, let us do not open hands and feet in JavaScript to do object-oriented, do apply.

If you've ever used jquery, then it's small and scalable and you can definitely feel it, do you have the experience of looking for a jquery plugin on the internet for a while?

jquery plug-ins are actually equivalent to asp.net ajax behavior Extensions (Behavior), and the number of extended behaviors in two frameworks is not an order of magnitude. So jquery is a great choice for most people.

Use of additional behavior in WPF

Behavior is a component that extends the functionality of the DOM element associated with it. This is an explanation of the behavior of the ASP.net Ajax framework.

So applied to WPF, the behavior is a component that extends the functionality of the element (also known as the control) associated with it

An attached behavior is a pattern that differs from an attached property, but it can be implemented in a way that is attached to a property. The following example

<fxui:textbox x:name= "SearchTextBox" margin= "2" grid.column= "1" >
<fxui:interaction. behaviors>
<fxui:autocommit buttonname= "SearchButton"/>
</fxui:interaction. Behaviors>
</fxui:TextBox>

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.