enode.SkipProperties.Add(name);
var value = Context.Values[node];
var serviceProvider = new XamlServiceProvider(enode, Context);
- var convertedValue = value.ConvertTo(parameter?.ParameterType, () => parameter, serviceProvider);
+ var convertedValue = value?.ConvertTo(parameter.ParameterType, () => parameter, serviceProvider);
array[i] = convertedValue;
}
return array;
prop = ApplyPropertiesVisitor.GetContentPropertyName(t.GetTypeInfo());
if (prop == null)
return;
- setter = t.GetRuntimeProperty(prop).SetMethod;
+ setter = t.GetRuntimeProperty(prop)?.SetMethod;
}
else
- setter = markupExtension.GetType().GetRuntimeProperty(prop).SetMethod;
+ setter = markupExtension.GetType().GetRuntimeProperty(prop)?.SetMethod;
if (value == null && strValue != null)
{
- value = strValue.ConvertTo(markupExtension.GetType().GetRuntimeProperty(prop).PropertyType,
+ value = strValue.ConvertTo(markupExtension.GetType().GetRuntimeProperty(prop)?.PropertyType,
(Func<TypeConverter>)null, serviceProvider);
}
var bindable = weakbindable.Target as BindableObject;
if (bindable == null)
continue;
- item.DetachFrom(bindable);
+ item?.DetachFrom(bindable);
}
}
base.ClearItems();
var bindable = weakbindable.Target as BindableObject;
if (bindable == null)
continue;
- item.AttachTo(bindable);
+ item?.AttachTo(bindable);
}
}
_associatedObjects.Add(new WeakReference(bindable));
}
foreach (T item in this)
- item.AttachTo(bindable);
+ item?.AttachTo(bindable);
}
protected virtual void OnDetachingFrom(BindableObject bindable)
{
foreach (T item in this)
- item.DetachFrom(bindable);
+ item?.DetachFrom(bindable);
lock (_associatedObjects)
{
for (var i = 0; i < _associatedObjects.Count; i++)
var bindable = weakbindable.Target as BindableObject;
if (bindable == null)
continue;
- item.DetachFrom(bindable);
+ item?.DetachFrom(bindable);
}
base.RemoveItem(index);
var bindable = weakbindable.Target as BindableObject;
if (bindable == null)
continue;
- old.DetachFrom(bindable);
+ old?.DetachFrom(bindable);
}
base.SetItem(index, item);
var bindable = weakbindable.Target as BindableObject;
if (bindable == null)
continue;
- item.AttachTo(bindable);
+ item?.AttachTo(bindable);
}
}
}
return;
if (IsSealed)
throw new InvalidOperationException("Can not change Property once the Trigger has been applied.");
+
_property = value;
//convert the value
if (_property != null && s_valueConverter != null)
{
- Func<MemberInfo> minforetriever = () => Property.DeclaringType.GetRuntimeProperty(Property.PropertyName);
- Value = s_valueConverter.Convert(Value, Property.ReturnType, minforetriever, null);
+ Func<MemberInfo> minforetriever = () => _property.DeclaringType.GetRuntimeProperty(_property.PropertyName);
+ Value = s_valueConverter.Convert(Value, _property.ReturnType, minforetriever, null);
}
}
}
//convert the value
if (_property != null && s_valueConverter != null)
{
- Func<MemberInfo> minforetriever = () => Property.DeclaringType.GetRuntimeProperty(Property.PropertyName);
- value = s_valueConverter.Convert(value, Property.ReturnType, minforetriever, null);
+ Func<MemberInfo> minforetriever = () => _property.DeclaringType.GetRuntimeProperty(_property.PropertyName);
+ _triggerValue = s_valueConverter.Convert(value, _property.ReturnType, minforetriever, null);
+ }
+ else
+ {
+ _triggerValue = value;
}
- _triggerValue = value;
+
}
}
throw new NotSupportedException("The collection is read-only");
int innerIndex = ToInnerIndex(index);
TTrack item = _list[innerIndex];
- if (item.Owned)
+ if (item != null && item.Owned)
{
_list.RemoveAt(innerIndex);
item.Owned = false;