Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Silverlight Databinding

1,057 views

Published on

About Databing in Silverlight

  • Be the first to comment

  • Be the first to like this

Silverlight Databinding

  1. 1. DATABINDING using silverlight 2.0 SRISAKTHI CHIPKIDZ
  2. 2. AGENDA <ul><li>DataBinding </li></ul><ul><li>Binding Expression </li></ul><ul><li>DataTemplate </li></ul><ul><li>Converters </li></ul><ul><li>BindingModes </li></ul>
  3. 3. DATABINDING <ul><li>Databinding is a mechanism for moving the data from objects into UI controls. </li></ul><ul><li>Databinding is the magic that that sits between our objects (know as a model ) and the UI (known as a view ). </li></ul>
  4. 4. BINDING EXPRESSION <ul><li>For basic databinding </li></ul><ul><li>1 .Binding Expression </li></ul><ul><li>2 .Data context </li></ul><ul><li>A binding expression is used inside the XAML to describe the name of the property that we want fetched from the model. </li></ul><ul><li>For example, </li></ul><ul><li><TextBlock Text=&quot;{Binding Name}&quot; /> </li></ul>
  5. 5. Contd… <ul><li>Most Silverlight controls will expose a DataContext property. </li></ul><ul><li>For example </li></ul><ul><li>Employee employee = new Employee() </li></ul><ul><li>{ </li></ul><ul><li>Name=“Sakthi”; </li></ul><ul><li>} this.DataContext = employee; </li></ul>
  6. 6. DATATEMPLATE <ul><li>A data template describes the controls we want to use when displaying each individual item in a collection. </li></ul><ul><li>For example </li></ul><ul><li><ListBox ItemsSource=&quot;{Binding}&quot;> </li></ul><ul><li><ListBox.ItemTemplate> </li></ul><ul><li><DataTemplate> </li></ul><ul><li><TextBlock Text=&quot;{Binding Name}&quot;></TextBlock> </li></ul><ul><li></DataTemplate> </li></ul><ul><li></ListBox.ItemTemplate> </li></ul>
  7. 7. CONVERTER <ul><li>Silverlight allows you to dynamically convert values during data binding. </li></ul><ul><li>You can accomplish this by first creating a custom class that represents a value converter. </li></ul><ul><li>This value converter can then be referenced in an XAML file. </li></ul>
  8. 8. BINDING MODES <ul><li>Three BindingModes are available </li></ul><ul><li>1. One-way Binding </li></ul><ul><li>2. Two-way Binding </li></ul><ul><li>3. OneTime Binding </li></ul><ul><li>The One-way BindingMode is the default option used when you create a Binding. </li></ul>
  9. 9. Contd… <ul><li>This option gives you the ability to automatically receive changes from a source property. </li></ul>
  10. 10. Contd… <ul><li>Two-way binding enables two properties that are bound to change each other. </li></ul><ul><li>The OneTime option sets the target property to the source property when a binding is initially made. </li></ul>
  11. 11. CONCLUSION <ul><li>Silverlight data binding features are flexible and powerful, and provide you with everything you need to build an effective business application. </li></ul><ul><li>It provide properties such as </li></ul><ul><li>1.CanUserResizeColumns </li></ul><ul><li>2.GridlinesVisibility </li></ul><ul><li>3.HeaderVisibility </li></ul><ul><li>4.RowDetailsVisibility and RowDetailsTemplate </li></ul><ul><li>5.SelectionMode </li></ul><ul><li>6.Opacity </li></ul>
  12. 12. <ul><li>www.shakthee-silverlight.blogspot.com </li></ul><ul><li>www.shakthee.webs.com </li></ul>
  13. 13. THANK YOU

×