Jan 7, 2014 at 1:13 PM
Edited Jan 8, 2014 at 6:50 AM
I want to customize my caliburn conventions to handles a custom control called BaseText.
If one of controls in use that derive from BaseText has the Tag property in xaml set equals to custom converter name, I want to attach this converter to binding.
I have tried as show above:
ConventionManager.AddElementConvention<BaseText>(BaseText.EditValueProperty, "Text", "EditValueChanged")
.ApplyBinding = (viewModelType, path, property, element, convention) =>
var bindableProperty = convention.GetBindableProperty(element);
if (!ConventionManager.SetBindingWithoutBindingOrValueOverwrite(viewModelType, path, property, element, convention, bindableProperty))
if ((string)element.Tag == "DateTimeToTimeSpanConverter")
Binding binding = BindingOperations
.GetBindingExpression(element as DependencyObject, bindableProperty)
binding.Converter = customConv;
binding.Converter = customConv
raise an error. Where is my mistake?
I can achieve my goal with a custom attribute on view-model, but I prefer to do this via ConventionManager.AddElementConvention. It's possible?
Thanks in advance.