BindingGroup::GetValue Method (Object, String)
Returns the proposed value for the specified property and item.
Assembly: PresentationFramework (in PresentationFramework.dll)
Parameters
- item
- Type: System::Object
The object that contains the specified property.
- propertyName
- Type: System::String
The property whose proposed value to get.
| Exception | Condition |
|---|---|
| InvalidOperationException | There is not a binding for the specified item and property. |
| ValueUnavailableException | The value of the specified property is not available, due to a conversion error or because an earlier validation rule failed. |
Use this method in the ValidationRule::Validate method to get the value to be committed to the source. The type of the return value depends on the stage at which the ValidationRule occurs. For example, if a TextBox is data bound to a property of type integer and the ValidationRule that calls GetValue(Object, String) has its ValidationStep set to RawProposedValue, the method returns a string. If the ValidationRule has its ValidationStep set to ConvertedProposedValue, the method returns whatever type that is returned by the binding's converter. In this example, GetValue(Object, String) usually returns an integer.
The following example is part of an application that prompts the user to enter multiple customers and assign a sales representative to each customer. The application checks that the sales representative and the customer belong to the same region. The example shows the Validate method, which uses the GetValue(Object, String) method to get values that the customer entered.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.