Attempts to get the proposed value for the specified property and item.
Assembly: PresentationFramework (in PresentationFramework.dll)
public: bool TryGetValue( Object^ item, String^ propertyName, [OutAttribute] Object^% value )
- Type: System::Object
The object that contains the specified property.
- Type: System::String
The property whose proposed value to get.
- Type: System::Object%
When this method returns, contains an object that represents the proposed property value. This parameter is passed uninitialized.
Return ValueType: System::Boolean
true if value is the proposed value for the specified property; otherwise, false.
returns false if there is not a binding for the specified item and property or if 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 value depends on the stage at which the ValidationRule occurs. For example, if a TextBox is data bound to a property of type integer, value is a string if the ValidationRule that calls has its ValidationStep set to RawProposedValue. If the ValidationRule has its ValidationStep set to ConvertedProposedValue, the type of value is whatever type that is returned by the binding's converter. In this example, value is usually an integer.
The following example creates a custom ValidationRule named ValidateDateAndPrice. In the Validate method, the example uses the method and the Items property to get the values the user entered into the form. Then the example checks that if an item is over 100 dollars, it will be available for at least seven days. This example is part of a larger example on the BindingGroup class