WpfDatabind1( WPF )

Objectives:
  • Comparing Binding Properties and an alternate approach.
    • Two Label controls are synchronized with two Text Boxes, one with Event and Other with Data binding, respectively. 
    • A source object is the object that contains the data, and the target object is a control that displays that data
  • Each binding event typically has these four components:
  • Target Object : If  a binding target object, e.g. Text Box o Label
  • Target property: Text property of a Text Box. The target property must be a dependency property. This also means that you cannot bind a field.

     

  • Binding source : The data source
    • Binding source types
      • CLR objects : may bind to public properties, indexers of CLR ICustomTypeDescriptor
      • dynamic object : can bind to the objects that implements IDynamicMetaObjectProvider
      • ADO.Net objects, the objects that implements I Binding
      • XML Objects
      • Dependency object :
  • a Path to the value in the binding source to use.
  • Binding Modes :
    • One Way : Read Only, Default, and does not change the data source
    • Two Way : Read & Write, change in target data will change the source
    • One Time: Binds one time from source to target and does not respond to change notification.

Code : MainWindow.xaml.txtMainWindow.xaml.cs.txt

Reference : http://blogs.msdn.com/b/wpfsdk/archive/2006/10/19/wpf-basic-data-binding-faq.aspx

Step:1 Create a New WPF  project

Step:2 Important Code highlights

a) XMAL -Mark Ups

b) Code Behind

Step:3 Runt tine view

A) Text Changed event: with Text Box 2

b) Data Binding from Source TextBox1 to the targets Labels: Unmark these two lines as shown below

Note the Text properties is copied to the label controls. now type some more words.

Step:4
Step:5
Step:6
Step:7
Step:8
Step:9
Step:10
Step:11
Step:12
Step:13
Step:14
Step:15
Step:16
Step:17