跟到这里然后怎么改?
[C#] 纯文本查看 复制代码
internal object GetValue(object item, int level)
{
bool flag = this.IsExtendedTraceEnabled(TraceDataLevel.CreateExpression);
object obj = DependencyProperty.UnsetValue;
PropertyInfo propertyInfo;
PropertyDescriptor propertyDescriptor;
DependencyProperty dependencyProperty;
DynamicPropertyAccessor dynamicPropertyAccessor;
this.SetPropertyInfo(this._arySVS[level].info, out propertyInfo, out propertyDescriptor, out dependencyProperty, out dynamicPropertyAccessor);
switch (this.SVI[level].type)
{
case SourceValueType.Property:
if (propertyInfo != null)
{
obj = propertyInfo.GetValue(item, null);
}
else if (propertyDescriptor != null)
{
bool indexerIsNext = level + 1 < this.SVI.Length && this.SVI[level + 1].type == SourceValueType.Indexer;
obj = this.Engine.GetValue(item, propertyDescriptor, indexerIsNext);
}
else if (dependencyProperty != null)
{
DependencyObject dependencyObject = (DependencyObject)item;
if (level != this.Length - 1 || this._host == null || this._host.TransfersDefaultValue)
{
obj = dependencyObject.GetValue(dependencyProperty);
}
else if (!Helper.HasDefaultValue(dependencyObject, dependencyProperty))
{
obj = dependencyObject.GetValue(dependencyProperty);
}
else
{
obj = BindingExpression.IgnoreDefaultValue;
}
}
else if (dynamicPropertyAccessor != null)
{
obj = dynamicPropertyAccessor.GetValue(item);
}
break;
case SourceValueType.Indexer:
if (propertyInfo != null)
{
object[] args = this._arySVS[level].args;
PropertyPathWorker.IListIndexerArg listIndexerArg;
if (args != null && args.Length == 1 && (listIndexerArg = (args[0] as PropertyPathWorker.IListIndexerArg)) != null)
{
int value = listIndexerArg.Value;
IList list = (IList)item;
if (0 <= value && value < list.Count)
{
obj = list[value];
}
else
{
obj = PropertyPathWorker.IListIndexOutOfRange;
}
}
else
{
obj = propertyInfo.GetValue(item, BindingFlags.GetProperty, null, args, CultureInfo.InvariantCulture);
}
}
else
{
DynamicIndexerAccessor dynamicIndexerAccessor;
if ((dynamicIndexerAccessor = (this._arySVS[level].info as DynamicIndexerAccessor)) == null)
{
throw new NotSupportedException(SR.Get("IndexedPropDescNotImplemented"));
}
obj = dynamicIndexerAccessor.GetValue(item, this._arySVS[level].args);
}
break;
case SourceValueType.Direct:
obj = item;
break;
}
if (flag)
{
object obj2 = this._arySVS[level].info;
if (obj2 == DependencyProperty.UnsetValue)
{
obj2 = null;
}
TraceData.Trace(TraceEventType.Warning, TraceData.GetValue(new object[]
{
TraceData.Identify(this._host.ParentBindingExpression),
level,
TraceData.Identify(item),
TraceData.IdentifyAccessor(obj2),
TraceData.Identify(obj)
}));
}
return obj;
}
还是我跟错了?
@wap6575
|