|
using System.Windows.Data;
namespace Test.BindingHub
{
/// <summary>
/// Calculating the length of text
/// Socket1: in, attempts binding to "Text" property
/// Socket2: out, attempts binding to "TextLength" property
/// Socket3-16: free
/// </summary>
public class Strategy : WPF.MichaelAgroskin.Bindings.BindingHub
{
public Strategy()
{
SetBinding(Socket1Property, new Binding("Text") { Mode = BindingMode.OneWay });
SetBinding(Socket2Property, new Binding("TextLength") { Mode = BindingMode.OneWayToSource });
Socket1Changed += (s, e) => Socket2 = string.Format("{0}", e.NewValue).Length;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Michael is a software developer who still remembers punch cards, computers with 4 Kbytes RAM, and 3270s. His personal computers were Apple IIe, Commodore, and PC XT (with the whole 640 Kbytes RAM and 2 floppy drives!!!). Wow, that was a powerhouse.
Fast forward 32 years through FORTRAN, PL-I, Algol, Pascal, Prolog, LISP, C, Basic, Clipper, Assembly, FoxPro, DHTML, JavaScript, C++, you name it, to C# 4.0.
Of course, real men use machine code to write software, but what a difference a few years make! No more mallocs and callocs, GC magically collects unused objects, dynamic objects magically call IUnknown::QueryInterface, Reflection magically gives you metadata and even generates help files, WPF magically binds stuff together...
Read some of Michael's articles here.
BindingHub (a WPF component and a design pattern) [
^].
Notifying parent of changes to children's properties [
^].
Point-In-Time database (coming soon)
Composite Menus and other ItemsControls (coming soon)
Adorners framework (coming soon)
Drag-n-drop data transfer framework (coming soon)
Converters and MarkupExtensions (coming soon)
Download complete WPF library [
^].