SlideShare ist ein Scribd-Unternehmen logo
1 von 9
Data Binding in Silverlight Mahender Senior Software Engineer United Health Group
Mahender Sarangam Having close to 5 years of experience. Working as a Senior Software Engineer in United Health Group. Good Knowledge on C#, ASP.NET, Silverlight, WPF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. MCTS Certified in Web Technologies.
Data Binding  Data binding is a mechanism for moving the data from objects into UI controls. Data binding is a key in Silverlight that allows data shown on UI and then process changes.  Data binding is a process that tells Silverlight to extract a property value from a source object and use it to set a property in a target object. Here Target Object which inherit from Dependency Object and its property must be a Dependency property. Data Binding works with Public properties of Source object. It does not work for fields.
Data Binding We use Binding expression for binding Source property to Target property. Here we don’t mention source object which contain data. Generally in WPF/Silverlight, control uses Data context as Source Object or try to use source property of Binding expression. <UserControl.Resources> <local:Product x:Key="resourceProduct" ModelNumber="AEFS100" ModelName="Portable Defibrillator" UnitCost="77" Description="Analyzes the electrical activity of a person's heart and applies an electric shock if necessary."> </local:Product> </UserControl.Resources> <TextBox Text="{Binding ModelNumber, Source={StaticResourceresourceProduct} }“></TextBox>
INotify Property Changed The INotifyPropertyChanged interface is a key part of the data binding infrastructure available in Silverlight. It contains a single event named PropertyChanged that is used to notify objects when a particular property value changes.
Data Context Data Context: The Data Context refers to a source of data that can be bound to a target. The Data Context often is set to an instance of an entity Data Context is inherited to child elements and this makes it ideal for scenarios where you want to bind multiple elements to a single data source. Data Context is a property of Framework Element We use Binding expression for binding Source property to Target property
Target Null Value and Fall Back values Target Null values are default values i.e. when bound data is NULL or there may be cases where value bounded is NULL.  For example:       <TextBox Text="{Binding ModelName, TargetNullValue='[No Model Name Set]' }"></TextBox> There might be cases , When Binding Properties to Target control ,binding throws exception or any binding operation failure , Fall back value provide a fall back value when binding is unable to return value <TextBox Text="{Binding ModelName, FallBackvalue='[No Model Name Set]' }"></TextBox>. String Format : Allows formatting of the bound value using standard formatting expressions.  <TextBlock x:Name="CurrencyExample" Text="{Binding Cost, StringFormat=C}"></TextBlock>  <TextBlock x:Name="BirthDateValueTextBlock" Text="{Binding BirthDate, StringFormat=MM/dd/yyyy}"></TextBlock>
Data Flow  Each Binding expression has Mode property which determines how and when the data flows.  There are 3 types of Data binding One Time Binding : Target property is set initially with the source data when the binding is created One way Binding : Update targets whenever source data changes. This is default Two Way Binding : The target property is updated when the source property changes, and the source Property is updated when the target property changes. UpdateSourceTrigger : Silverlight supports only two values for Update SourceTrigger: Default and Explicit. It isn’t possible to choose PropertyChanged ValidateonErrors and validate on exceptions
Thank you!

Weitere ähnliche Inhalte

Andere mochten auch

Introduction to silverlight
Introduction to silverlightIntroduction to silverlight
Introduction to silverlightmsarangam
 
Resources and styles
Resources and stylesResources and styles
Resources and stylesmsarangam
 
Silverlight converters
Silverlight convertersSilverlight converters
Silverlight convertersmsarangam
 
Silverlight control template
Silverlight control templateSilverlight control template
Silverlight control templatemsarangam
 
Introduction to silverlight control 4
Introduction to silverlight control 4Introduction to silverlight control 4
Introduction to silverlight control 4msarangam
 
Silverlight datatemplate
Silverlight datatemplateSilverlight datatemplate
Silverlight datatemplatemsarangam
 

Andere mochten auch (7)

Introduction to silverlight
Introduction to silverlightIntroduction to silverlight
Introduction to silverlight
 
Resources and styles
Resources and stylesResources and styles
Resources and styles
 
Silverlight converters
Silverlight convertersSilverlight converters
Silverlight converters
 
Html bridge
Html bridgeHtml bridge
Html bridge
 
Silverlight control template
Silverlight control templateSilverlight control template
Silverlight control template
 
Introduction to silverlight control 4
Introduction to silverlight control 4Introduction to silverlight control 4
Introduction to silverlight control 4
 
Silverlight datatemplate
Silverlight datatemplateSilverlight datatemplate
Silverlight datatemplate
 

Ähnlich wie Data binding in silverlight

Silverlight 5 whats new overview
Silverlight 5 whats new overviewSilverlight 5 whats new overview
Silverlight 5 whats new overviewmdc11
 
Data Binding in Silverlight
Data Binding in SilverlightData Binding in Silverlight
Data Binding in SilverlightBoulos Dib
 
WPF & Silverlight UI
WPF & Silverlight UIWPF & Silverlight UI
WPF & Silverlight UIDave Allen
 
Flex3 data binding
Flex3 data bindingFlex3 data binding
Flex3 data bindingguestdf3003
 
Ui5con blr databinding
Ui5con blr databindingUi5con blr databinding
Ui5con blr databindingjatin dharani
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaJignesh Aakoliya
 
Entity framework and how to use it
Entity framework and how to use itEntity framework and how to use it
Entity framework and how to use itnspyre_net
 
TERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
TERMINALFOUR t44u 2009 - Data objects, Web object & External SourcesTERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
TERMINALFOUR t44u 2009 - Data objects, Web object & External SourcesTerminalfour
 
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...Edureka!
 
Flex data binding pitfalls: 10 common misuses and mistakes
Flex data binding pitfalls: 10 common misuses and mistakesFlex data binding pitfalls: 10 common misuses and mistakes
Flex data binding pitfalls: 10 common misuses and mistakesElad Elrom
 
Learning To Run - XPages for Lotus Notes Client Developers
Learning To Run - XPages for Lotus Notes Client DevelopersLearning To Run - XPages for Lotus Notes Client Developers
Learning To Run - XPages for Lotus Notes Client DevelopersKathy Brown
 
Polymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele GallottiPolymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele GallottiThinkOpen
 

Ähnlich wie Data binding in silverlight (20)

Silverlight 5 whats new overview
Silverlight 5 whats new overviewSilverlight 5 whats new overview
Silverlight 5 whats new overview
 
Simple Data Binding
Simple Data BindingSimple Data Binding
Simple Data Binding
 
Data Binding in Silverlight
Data Binding in SilverlightData Binding in Silverlight
Data Binding in Silverlight
 
WPF and Databases
WPF and DatabasesWPF and Databases
WPF and Databases
 
Silverlight Databinding
Silverlight DatabindingSilverlight Databinding
Silverlight Databinding
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
 
WPF & Silverlight UI
WPF & Silverlight UIWPF & Silverlight UI
WPF & Silverlight UI
 
Flex3 data binding
Flex3 data bindingFlex3 data binding
Flex3 data binding
 
Ui5con blr databinding
Ui5con blr databindingUi5con blr databinding
Ui5con blr databinding
 
Overview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company indiaOverview of entity framework by software outsourcing company india
Overview of entity framework by software outsourcing company india
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Entity framework and how to use it
Entity framework and how to use itEntity framework and how to use it
Entity framework and how to use it
 
TERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
TERMINALFOUR t44u 2009 - Data objects, Web object & External SourcesTERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
TERMINALFOUR t44u 2009 - Data objects, Web object & External Sources
 
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...
Angular 4 Data Binding | Two Way Data Binding in Angular 4 | Angular 4 Tutori...
 
Flex data binding pitfalls: 10 common misuses and mistakes
Flex data binding pitfalls: 10 common misuses and mistakesFlex data binding pitfalls: 10 common misuses and mistakes
Flex data binding pitfalls: 10 common misuses and mistakes
 
exa_cer_g23
exa_cer_g23exa_cer_g23
exa_cer_g23
 
Learning To Run - XPages for Lotus Notes Client Developers
Learning To Run - XPages for Lotus Notes Client DevelopersLearning To Run - XPages for Lotus Notes Client Developers
Learning To Run - XPages for Lotus Notes Client Developers
 
Polymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele GallottiPolymer 3.0 by Michele Gallotti
Polymer 3.0 by Michele Gallotti
 
J2EE pattern 5
J2EE pattern 5J2EE pattern 5
J2EE pattern 5
 
Php frameworks
Php frameworksPhp frameworks
Php frameworks
 

Mehr von msarangam

Silverlight command
Silverlight commandSilverlight command
Silverlight commandmsarangam
 
Silverlight as a desktop application
Silverlight as a desktop applicationSilverlight as a desktop application
Silverlight as a desktop applicationmsarangam
 
Routed events in silverlight
Routed events in silverlightRouted events in silverlight
Routed events in silverlightmsarangam
 
Ria services
Ria servicesRia services
Ria servicesmsarangam
 
Printing in sl
Printing in slPrinting in sl
Printing in slmsarangam
 
Navigation application in silverlight
Navigation application in silverlightNavigation application in silverlight
Navigation application in silverlightmsarangam
 
Data binding in silverlight
Data binding in silverlightData binding in silverlight
Data binding in silverlightmsarangam
 
Mvvm pattern
Mvvm patternMvvm pattern
Mvvm patternmsarangam
 
Introduction to silverlight control 3
Introduction to silverlight control  3Introduction to silverlight control  3
Introduction to silverlight control 3msarangam
 
Data validation in silverlight
Data validation in silverlightData validation in silverlight
Data validation in silverlightmsarangam
 
Background thread
Background threadBackground thread
Background threadmsarangam
 
Attached property
Attached propertyAttached property
Attached propertymsarangam
 
Application in detail
Application in detailApplication in detail
Application in detailmsarangam
 
Wcf ria services
Wcf ria servicesWcf ria services
Wcf ria servicesmsarangam
 

Mehr von msarangam (16)

File access
File accessFile access
File access
 
Silverlight command
Silverlight commandSilverlight command
Silverlight command
 
Silverlight as a desktop application
Silverlight as a desktop applicationSilverlight as a desktop application
Silverlight as a desktop application
 
Routed events in silverlight
Routed events in silverlightRouted events in silverlight
Routed events in silverlight
 
Ria services
Ria servicesRia services
Ria services
 
File access
File accessFile access
File access
 
Printing in sl
Printing in slPrinting in sl
Printing in sl
 
Navigation application in silverlight
Navigation application in silverlightNavigation application in silverlight
Navigation application in silverlight
 
Data binding in silverlight
Data binding in silverlightData binding in silverlight
Data binding in silverlight
 
Mvvm pattern
Mvvm patternMvvm pattern
Mvvm pattern
 
Introduction to silverlight control 3
Introduction to silverlight control  3Introduction to silverlight control  3
Introduction to silverlight control 3
 
Data validation in silverlight
Data validation in silverlightData validation in silverlight
Data validation in silverlight
 
Background thread
Background threadBackground thread
Background thread
 
Attached property
Attached propertyAttached property
Attached property
 
Application in detail
Application in detailApplication in detail
Application in detail
 
Wcf ria services
Wcf ria servicesWcf ria services
Wcf ria services
 

Kürzlich hochgeladen

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Kürzlich hochgeladen (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Data binding in silverlight

  • 1. Data Binding in Silverlight Mahender Senior Software Engineer United Health Group
  • 2. Mahender Sarangam Having close to 5 years of experience. Working as a Senior Software Engineer in United Health Group. Good Knowledge on C#, ASP.NET, Silverlight, WPF ,SQL Server, Team Foundation Server(TFS) and SharePoint Technology. MCTS Certified in Web Technologies.
  • 3. Data Binding Data binding is a mechanism for moving the data from objects into UI controls. Data binding is a key in Silverlight that allows data shown on UI and then process changes. Data binding is a process that tells Silverlight to extract a property value from a source object and use it to set a property in a target object. Here Target Object which inherit from Dependency Object and its property must be a Dependency property. Data Binding works with Public properties of Source object. It does not work for fields.
  • 4. Data Binding We use Binding expression for binding Source property to Target property. Here we don’t mention source object which contain data. Generally in WPF/Silverlight, control uses Data context as Source Object or try to use source property of Binding expression. <UserControl.Resources> <local:Product x:Key="resourceProduct" ModelNumber="AEFS100" ModelName="Portable Defibrillator" UnitCost="77" Description="Analyzes the electrical activity of a person's heart and applies an electric shock if necessary."> </local:Product> </UserControl.Resources> <TextBox Text="{Binding ModelNumber, Source={StaticResourceresourceProduct} }“></TextBox>
  • 5. INotify Property Changed The INotifyPropertyChanged interface is a key part of the data binding infrastructure available in Silverlight. It contains a single event named PropertyChanged that is used to notify objects when a particular property value changes.
  • 6. Data Context Data Context: The Data Context refers to a source of data that can be bound to a target. The Data Context often is set to an instance of an entity Data Context is inherited to child elements and this makes it ideal for scenarios where you want to bind multiple elements to a single data source. Data Context is a property of Framework Element We use Binding expression for binding Source property to Target property
  • 7. Target Null Value and Fall Back values Target Null values are default values i.e. when bound data is NULL or there may be cases where value bounded is NULL. For example: <TextBox Text="{Binding ModelName, TargetNullValue='[No Model Name Set]' }"></TextBox> There might be cases , When Binding Properties to Target control ,binding throws exception or any binding operation failure , Fall back value provide a fall back value when binding is unable to return value <TextBox Text="{Binding ModelName, FallBackvalue='[No Model Name Set]' }"></TextBox>. String Format : Allows formatting of the bound value using standard formatting expressions. <TextBlock x:Name="CurrencyExample" Text="{Binding Cost, StringFormat=C}"></TextBlock> <TextBlock x:Name="BirthDateValueTextBlock" Text="{Binding BirthDate, StringFormat=MM/dd/yyyy}"></TextBlock>
  • 8. Data Flow Each Binding expression has Mode property which determines how and when the data flows. There are 3 types of Data binding One Time Binding : Target property is set initially with the source data when the binding is created One way Binding : Update targets whenever source data changes. This is default Two Way Binding : The target property is updated when the source property changes, and the source Property is updated when the target property changes. UpdateSourceTrigger : Silverlight supports only two values for Update SourceTrigger: Default and Explicit. It isn’t possible to choose PropertyChanged ValidateonErrors and validate on exceptions