Wpf Binding Cheatsheet Version Page 3

ADVERTISEMENT

using TemplateBinding instead.
Can’t be used if ElementName or Source is set.
Source
Object to use as the binding source.
Can’t be used if ElementName or RelativeSource is set
StringFormat (3.5sp1)
Format string to use when converting the bound value to a string.
Works only if the target property is of type string.
TargetNullValue (3.5sp1)
Value to use when the bound value is null.
UpdateSourceExceptionFilter
Custom logic for handling exceptions that the binding engine encounters.
Only if you add an ExceptionValidationRule to ValidationRules or set
ValidatesOnExceptions.
UpdateSourceTrigger
timing of binding source updates, possible options:
Default - The default UpdateSourceTrigger value of the
binding target property. The default is usually PropertyChanged,
while the Text property is LostFocus.
PropertyChanged - Updates the binding source immediately
whenever the binding target property changes.
LostFocus - Updates the binding source whenever the binding
target element loses focus.
Explicit - Updates the binding source only when you call the
UpdateSource method.
ValidatesOnDataErrors (3.5sp1)
Use IDataErrorInfo when validating.
ValidatesOnExceptions (3.5sp1)
Treat exceptions as validation failures.
ValidationRules
Collection of rules that check the validity of the user input.
XPath
XPath query that returns the value on the XML binding source to use.
Top
The Internationalization Fix
By default, when you use data binding and the target property is a string, WPF will format your
value using the US English culture, to use the correct setting the user seletceted in the control
panel add the following code before loading any GUI (the Application.Startup event is a good
place)
FrameworkElement.LanguageProperty.OverrideMetadata(
typeof(FrameworkElement),
new
FrameworkPropertyMetadata(
XmlLanguage.GetLanguage(
CultureInfo.CurrentCulture.IetfLanguageTag)));

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Business
Go
Page of 3