public static GetValue ( PropertyInfo, prop, object owner, string path = null, Array, index = null ) : object | ||
prop | PropertyInfo, | |
owner | object | |
path | string | |
index | Array, | |
Результат | object |
/// <summary> /// Validates the value of current cell. /// </summary> /// <param name="currentCell"> /// The current cell that is to validated. /// </param> /// <param name="propertyName"> /// The propertyName. /// </param> /// <param name="dataModel"> /// The dataModel. /// </param> /// <returns> /// <b>true</b> if the validation is successful; otherwise, <b>false</b>. /// </returns> internal static bool Validate(TreeGridCell currentCell, string propertyName, object dataModel) { bool hasError = false; var itemproperties = currentCell.ColumnBase.TreeGridColumn.TreeGrid.View.GetItemProperties(); // WPF-25016 Using PropertyDescriptorExtensions for WPF and PropertyInfoExtensions for WinRT, the codes are cleaned up if (propertyName.Contains('.')) { var propNames = propertyName.Split('.'); propertyName = propNames[propNames.Length - 1]; Array.Resize(ref propNames, propNames.Length - 1); var pName = string.Join(".", propNames); #if WPF dataModel = PropertyDescriptorExtensions.GetValue(itemproperties, dataModel, pName); #else dataModel = PropertyInfoExtensions.GetValue(itemproperties, dataModel, pName); #endif } if (dataModel == null) { return(hasError); } #if WPF var dataValidation = dataModel as IDataErrorInfo; if (dataValidation != null) { string errormessage = dataValidation[propertyName]; hasError = !String.IsNullOrEmpty(errormessage); if (hasError) { currentCell.bindingErrorMessage = errormessage; } currentCell.ApplyValidationVisualState(); return(!hasError); } #endif #if !SyncfusionFramework4_0 || UWP hasError = !ValidateINotifyDataErrorInfo(currentCell, propertyName, dataModel); #endif return(!hasError); }
public void GetValueNullTest() { Assert.IsNotNull(PropertyInfoExtensions.GetValue(null, 0)); Assert.Fail(); }