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>