Beispiel #1
0
        private void UpdateBindings()
        {
            var template = IsEditing ? EditingElement : Element;

            contentPresenter.ContentTemplate = template;
            contentPresenter.ApplyTemplate();
            UpdateRootElement();

            if (CurrentRootElement != null)
            {
                var bindingTargetProperty = GetBindingTargetProperty(CurrentRootElement);
                var appliedBinding        = BindingUtils.CloneBinding(Binding);
                if (appliedBinding is Binding)
                {
                    ((Binding)appliedBinding).Mode = IsEditing ? BindingMode.TwoWay : BindingMode.OneWay;
                }
                BindingOperations.SetBinding(CurrentRootElement, bindingTargetProperty, appliedBinding);

                SetBindings(CurrentRootElement);
            }
        }