Example #1
0
        protected override void OnApplyTemplate()
#endif
        {
            base.OnApplyTemplate();

            if (Template == null)
            {
                return;
            }

            _linePathObject = GetTemplatePart("PART_edgePath") as Path;
            if (_linePathObject == null)
            {
                throw new GX_ObjectNotFoundException("EdgeControl Template -> Edge template must contain 'PART_edgePath' Path object to draw route points!");
            }
            _linePathObject.Data = _linegeometry;
            if (this.FindDescendantByName("PART_edgeArrowPath") != null)
            {
                throw new GX_ObsoleteException("PART_edgeArrowPath is obsolete! Please use new DefaultEdgePointer object in your EdgeControl template!");
            }

            _edgeLabelControl = GetTemplatePart("PART_edgeLabel") as IEdgeLabelControl;

            _edgePointerForSource = GetTemplatePart("PART_EdgePointerForSource") as IEdgePointer;
            _edgePointerForTarget = GetTemplatePart("PART_EdgePointerForTarget") as IEdgePointer;

            SelfLoopIndicator = GetTemplatePart("PART_SelfLoopedEdge") as FrameworkElement;
            if (SelfLoopIndicator != null)
            {
                SelfLoopIndicator.LayoutUpdated += (sender, args) =>
                {
                    if (SelfLoopIndicator != null)
                    {
                        SelfLoopIndicator.Arrange(_selfLoopedEdgeLastKnownRect);
                    }
                }
            }
            ;

            MeasureChild(_edgePointerForSource as UIElement);
            MeasureChild(_edgePointerForTarget as UIElement);
            MeasureChild(SelfLoopIndicator);
            //TODO measure label?

            UpdateSelfLoopedEdgeData();

            UpdateEdge();
        }
 /// <summary>
 /// Internal method. Attaches label to control
 /// </summary>
 /// <param name="ctrl"></param>
 public void AttachLabel(IEdgeLabelControl ctrl)
 {
     EdgeLabelControl = ctrl;
     UpdateLabelLayout();
 }
Example #3
0
        protected override void OnApplyTemplate()
#endif
        {
            base.OnApplyTemplate();

            if (Template == null) return;

            _linePathObject = GetTemplatePart("PART_edgePath") as Path;
            if (_linePathObject == null) throw new GX_ObjectNotFoundException("EdgeControl Template -> Edge template must contain 'PART_edgePath' Path object to draw route points!");
            _linePathObject.Data = _linegeometry;
            if (this.FindDescendantByName("PART_edgeArrowPath") != null)
                throw new GX_ObsoleteException("PART_edgeArrowPath is obsolete! Please use new DefaultEdgePointer object in your EdgeControl template!");

            _edgeLabelControl = GetTemplatePart("PART_edgeLabel") as IEdgeLabelControl;

            _edgePointerForSource = GetTemplatePart("PART_EdgePointerForSource") as IEdgePointer;
            _edgePointerForTarget = GetTemplatePart("PART_EdgePointerForTarget") as IEdgePointer;

            SelfLoopIndicator = GetTemplatePart("PART_SelfLoopedEdge") as FrameworkElement;
            if(SelfLoopIndicator != null)
                SelfLoopIndicator.LayoutUpdated += (sender, args) =>
                {
                    if (SelfLoopIndicator != null) SelfLoopIndicator.Arrange(_selfLoopedEdgeLastKnownRect);
                };

            MeasureChild(_edgePointerForSource as UIElement);
            MeasureChild(_edgePointerForTarget as UIElement);
            MeasureChild(SelfLoopIndicator);
            //TODO measure label?

            UpdateSelfLoopedEdgeData();

            UpdateEdge();
        }
 public EdgeLabelSelectedEventArgs(IEdgeLabelControl label, EdgeControl ec, PointerRoutedEventArgs e, object nu = null)
     : base(ec, e)
 {
     EdgeLabelControl = label;
 }
 public EdgeLabelSelectedEventArgs(IEdgeLabelControl label, EdgeControl ec, MouseButtonEventArgs e, ModifierKeys keys)
     : base(ec, e, keys)
 {
     EdgeLabelControl = label;
 }