. , , . , ContentControl.ContentProperty, TextBlock.TextProperty, TextBox.TextProperty ..
DataForm Silverlight . , , GetPropertyByPath. , , , . , DataForm .
DisplayAttribute , .
public static PropertyInfo GetPropertyByPath( object obj, string propertyPath )
{
ParameterValidation.ThrowIfNullOrWhitespace( propertyPath, "propertyPath" );
if ( obj == null ) {
return null;
}
Type type = obj.GetType( );
PropertyInfo propertyInfo = null;
foreach ( var part in propertyPath.Split( new char[] { '.' } ) ) {
if ( propertyInfo != null ) {
type = propertyInfo.PropertyType;
}
propertyInfo = type.GetProperty( part );
if ( propertyInfo == null ) {
return null;
}
if ( propertyInfo.GetIndexParameters( ).Length > 0 ) {
return null;
}
}
return propertyInfo;
}