internal void DrawComplexPropertyRelation(TypeBaseDesigner otherTypeDesigner, UIRelatedProperty relatedProperty)
 {
     if (RelationsContenerByRelatedProperty.ContainsKey(relatedProperty) || otherTypeDesigner.RelationsContenerByRelatedProperty.ContainsKey(relatedProperty))
         return;
     var complexProperty = (ComplexProperty)relatedProperty.BusinessInstance;
     int typeDesignerItemIndex;
     var complexPropertyRelation = new ComplexPropertyRelation(Designer, this, otherTypeDesigner, GetListViewItem(complexProperty, out typeDesignerItemIndex), typeDesignerItemIndex);
     var relationContener = new RelationContener(complexPropertyRelation);
     Designer.Children.Add(relationContener);
     relationContener.SetBinding(Canvas.LeftProperty, new Binding { Source = complexPropertyRelation, Path = new PropertyPath("CanvasLeft") });
     relationContener.SetBinding(Canvas.TopProperty, new Binding { Source = complexPropertyRelation, Path = new PropertyPath("CanvasTop") });
     AddRelationContenerByRelatedProperty(UIType.Properties[complexProperty], relationContener);
     otherTypeDesigner.AddRelationContenerWithoutRelatedProperty(relationContener);
 }
 private TypeBaseDesigner GetRelatedTypeDesigner(UIRelatedProperty relatedProperty)
 {
     return GetTypeDesigner(relatedProperty.RelatedType);
 }
 private void DrawComplexPropertyRelationAfterAddedComplexProperty(UIComplexType uiComplexType, UIRelatedProperty uiComplexProperty)
 {
     SizeChangedEventHandler actionToDoWhenNewItemAdded = null;
     actionToDoWhenNewItemAdded =
         delegate
         {
             var complexProperty = uiComplexProperty.BusinessInstance as ComplexProperty;
             if (Designer.DesignerView.ContainsEntityType(uiComplexType))
                 DrawComplexPropertyRelation(GetRelatedTypeDesigner(uiComplexProperty), uiComplexProperty);
             propertiesListView.SelectedValue = uiComplexProperty;
             GetListViewItem(complexProperty).Focus();
             propertiesListView.SizeChanged -= actionToDoWhenNewItemAdded;
         };
     propertiesListView.SizeChanged += actionToDoWhenNewItemAdded;
 }
        protected virtual void DrawRelation(UIRelatedProperty relatedProperty)
        {
            var otherTypeDesigner = GetRelatedTypeDesigner(relatedProperty);

            var navigationProperty = (relatedProperty.BusinessInstance as NavigationProperty);
            if (navigationProperty != null)
                DrawAssociation(otherTypeDesigner, navigationProperty);

            if (relatedProperty.BusinessInstance is ComplexProperty)
                DrawComplexPropertyRelation(otherTypeDesigner, relatedProperty);
        }
 protected override void DrawRelation(UIRelatedProperty relatedProperty)
 {
     base.DrawRelation(relatedProperty);
     foreach (var typeDesigner in Designer.Children.OfType<TypeBaseDesigner>().ToList())
         typeDesigner.DrawComplexPropertyRelation(this, relatedProperty);
 }