Bagikan melalui


How to: Set Data Binding Properties by Using the WPF Designer

This procedure shows you how to use the WPF Designer for Visual Studio to set properties on a data binding that connects data to a control.

To set properties on a data binding

  1. Create a data binding by using the data binding builder. For more information, see Walkthrough: Creating a Data Binding by Using the WPF Designer.

  2. In the Properties window, scroll to the property that has the data binding.

  3. At the edge of the left column, click the property marker (property marker).

    A menu appears.

    Tip

    You can also right-click the row to display the menu.

  4. Click Apply Data Binding.

    The data binding builder appears.

    data binding builder

  5. Click the Options pane.

    Options pane of the data binding builder

  6. Set properties on the data binding by selecting a combination of the following settings.

    Option

    Description

    String Format

    Sets the string format. Click the down-arrow to select from a list of pre-defined formats, or enter your own format. For more information, see Formatting Types.

    Mode

    Sets the BindingMode value for the data binding.

    UpdateSourceTrigger

    Sets the UpdateSourceTrigger value for the data binding.

    NotifyOnValidationError

    Sets a value that indicates whether to raise the Error attached event on the bound object.

    ValidatesOnDataErrors

    Sets a value that indicates whether to include the DataErrorValidationRule.

    ValidatesOnExceptions

    Sets a value that indicates whether to include the ExceptionValidationRule.

    Include TargetNullValue

    Sets the value that is used in the target when the value of the source is null.

    BindsDirectlyToSource

    Sets a value that indicates whether to evaluate the Path relative to the data item or the DataSourceProvider object.

    IsAsync

    Sets a value that indicates whether the binding gets and sets values asynchronously.

    NotifyOnSourceUpdated

    Sets a value that indicates whether to raise the SourceUpdated event when a value is transferred from the binding target to the binding source.

    NotifyOnTargetUpdated

    Sets a value that indicates whether to raise the TargetUpdated event when a value is transferred from the binding source to the binding target.

See Also

Tasks

Walkthrough: Creating a Data Binding by Using the WPF Designer

Reference

Binding

Mode

UpdateSourceTrigger

NotifyOnValidationError

ValidatesOnDataErrors

ValidatesOnExceptions

TargetNullValue

BindsDirectlyToSource

IsAsync

NotifyOnSourceUpdated

NotifyOnTargetUpdated

Concepts

Data Binding Overview

Other Resources

Data Binding in the WPF Designer