예제 #1
0
        private void SetupRelationshipNameAdorner(AdornerLayer layer)
        {
            TextShapeDecoration decor = new TextShapeDecoration(this);

            decor.CentreText = true;

            var multiBinding = new MultiBinding();

            multiBinding.Bindings.Add(new Binding {
                Source = this, Path = new PropertyPath(StartPointProperty)
            });
            multiBinding.Bindings.Add(new Binding {
                Source = this, Path = new PropertyPath(EndPointProperty)
            });
            multiBinding.Converter = new MiddleOfLineConverter();

            decor.SetBinding(TextShapeDecoration.AnchorProperty, multiBinding);

            decor.SetBinding(TextShapeDecoration.TextProperty,
                             new Binding {
                Source = this, Path = new PropertyPath(ConnectionNameProperty)
            });
            decor.SetBinding(VisibilityProperty,
                             new Binding {
                Source = this, Path = new PropertyPath(NameVisibleProperty), Converter = new VisibilityConverter()
            });

            layer.Add(decor);
        }
예제 #2
0
        private void SetupRelationshipNameAdorner(AdornerLayer layer)
        {
            TextShapeDecoration decor = new TextShapeDecoration(this);
            decor.CentreText = true;

            var multiBinding = new MultiBinding();
            multiBinding.Bindings.Add(new Binding{ Source = this, Path = new PropertyPath(StartPointProperty) });
            multiBinding.Bindings.Add(new Binding{ Source = this, Path = new PropertyPath(EndPointProperty) });
            multiBinding.Converter = new MiddleOfLineConverter();

            decor.SetBinding(TextShapeDecoration.AnchorProperty, multiBinding);

            decor.SetBinding(TextShapeDecoration.TextProperty,
                             new Binding {Source = this, Path = new PropertyPath(ConnectionNameProperty)});
            decor.SetBinding(VisibilityProperty,
                             new Binding { Source = this, Path = new PropertyPath(NameVisibleProperty), Converter = new VisibilityConverter() });

            layer.Add(decor);
        }