Last Updated: 04 Mar 2019 11:39 by ADMIN
Created on: 03 Jul 2015 13:00
Category: Diagram
Type: Feature Request
Diagram: Change the ConnectionPoints property of the RadDiagramConnection to be DependencyProperty
A possible workaround is to use an attached property. Basically, we've added ConnectionPointsProperty in AttachedProperties class and added binding to this new property in the style of the connection.

public class AttachedProperties
        public static RadDiagram Diagram { get; set; }

        public static readonly DependencyProperty ConnectionPointsProperty =
           DependencyProperty.RegisterAttached("ConnectionPoints", typeof(List<Point>), typeof(AttachedProperties), new PropertyMetadata(null, OnConnectionPointsChanged));

        public static IEnumerable<Point> GetConnectionPoints(DependencyObject obj)
            return (IEnumerable<Point>)obj.GetValue(ConnectionPointsProperty);

        public static void SetConnectionPoints(DependencyObject obj, IEnumerable<Point> value)
            obj.SetValue(ConnectionPointsProperty, value);

        private static void OnConnectionPointsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
            var connection = d as RadDiagramConnection;
            var connectionPoints = e.NewValue as List<Point>;
            if (connection != null && connectionPoints != null)
                for (int i = 0; i <  connectionPoints.ToList().Count; i++)
                connection.IsModified = true;
                (connection as IConnection).Update();

                <Style TargetType="telerik:RadDiagramConnection">
                    <Setter Property="ConnectionType" Value="Polyline"/>
                    <Setter Property="local:AttachedProperties.ConnectionPoints" Value="{Binding MyConnectionPoints}"/>
1 comment
Imported User
Posted on: 06 Jul 2015 06:22
This would help the design of the diagram because the ConnectionPoints will be able to be added in XAML and therefore be rendered in the designer.