コード例 #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
ファイル: Connection.cs プロジェクト: uQr/Visual-NHibernate
        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);
        }