public Binding(IBindableFieldAttribute attribute, int level) { Path = attribute.Path; BindingMode = attribute.BindingMode; var constAttribute = attribute as IConstAttribute; if (constAttribute != null && Path == null) { IsConst = true; _constValue = constAttribute.GetConstValue(); } if (attribute.ConverterType != null) { ValueConverter = Activator.CreateInstance(attribute.ConverterType) as IValueConverter; if (ValueConverter == null) { var message = string.Format("{0} does not implement IValueConverter.", attribute.ConverterType); throw new InvalidOperationException(message); } ConverterParameter = attribute.ConverterParameter; } RelativeSourceMode = attribute.RelativeSourceMode; Level = level; }