private static bool Bind(ElementConvention convention, FrameworkContentElement element, string bindPath, PropertyInfo property, Type viewModelType) { var bindableProperty = convention.GetBindableProperty(element); if (bindableProperty == null || element.GetBindingExpression(bindableProperty) != null) { return(false); } var binding = new Binding(bindPath); ConventionManager.ApplyBindingMode(binding, property); ConventionManager.ApplyValueConverter(binding, bindableProperty, property); ConventionManager.ApplyStringFormat(binding, convention, property); ConventionManager.ApplyValidation(binding, viewModelType, property); ConventionManager.ApplyUpdateSourceTrigger(bindableProperty, element, binding, property); BindingOperations.SetBinding(element, bindableProperty, binding); return(true); }