We are using different binding modes
for populating the value in to the UI.
We can set the values using Mode
property of binding. The values are available in System.Windows.Data.BindingMode enumeration.
Values of Binding Mode Enumeration
OneWay
The target property is updated only when the source property changes.
<TextBlock Text="{Binding
firstname , Mode=OneWay}"></TextBlock>
TwoWay The target property is updated only when the source property changes and the source property is changed/Updated when the target property is changed.
<TextBlock Text="{Binding firstname , Mode=TwoWay}"></TextBlock>
OneTime
The target property set initially based on the Source property value. However, changes are ignored from that point onword.Usually we can use this mode to reduce the overhead.
<TextBlock Text="{Binding firstname , Mode=OneTime}"></TextBlock>
OneWayToSource
It is just opposite of Oneway.Soure is updated when the target property
changes,But the target property is never updated.
<TextBlock Text="{Binding
firstname , Mode=OneWayToSource}"></TextBlock>
Default
The type of bindings depends on the target property It is either twoway
or oneway.<TextBlock Text="{Binding firstname , Mode=Default}"></TextBlock>
No comments:
Post a Comment