AvalonDock and Caliburn.Micro compatibility

Sep 29, 2010 at 11:54 AM

I try to use Caliburn.Micro with  AvalonDock application and i have a problem (wll know for AvalonDock programmers http://avalondock.codeplex.com/wikipage?title=AvalonDock%20Binding&referringTitle=Documentation ) when I drag & drop a View because until the View is a popup window lost the Logical bind.  The most common solution its force the "DataBinding" at application level vs "ItemControl" level. For do it I think I must change something at ConventionManager.SetBinding but I need some guide (obiusly I'm not a expert of Binding and WPF ).

Can somebody give me a hand :-)

Thank you!

Sep 29, 2010 at 7:29 PM

I respond myself.  Only needs to set Source of binding object to DataContext of element. I add one line At ConventionManager.cs


 /// <summary>
        /// Creates a binding and sets it on the element.
        /// </summary>
        public static Func<Type, string, PropertyInfo, FrameworkElement, ElementConvention, bool> SetBinding =
            (viewModelType, path, property, element, convention) => {
                var bindableProperty = convention.GetBindableProperty(element);
                if(HasBinding(element, bindableProperty))
                    return false;

                var binding = new Binding(path);

                ApplyBindingMode(binding, property);
                ApplyValueConverter(binding, bindableProperty, property);
                ApplyStringFormat(binding, convention, property);
                ApplyValidation(binding, viewModelType, property);
                ApplyUpdateSourceTrigger(bindableProperty, element, binding);
                binding.Source = binding.Source ?? element.DataContext; //STJLM.  AvalonDock compatibility
                BindingOperations.SetBinding(element, bindableProperty, binding);

                return true;