示例#1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (Template != null)
            {
                path  = Template.FindName("PART_edgePath", this) as Path;
                arrow = Template.FindName("PART_EdgePointerForTarget", this) as IEdgePointer;

                //
                UpdateEdge();
            }
        }
        protected override void OnApplyTemplate()
#endif
        {
            base.OnApplyTemplate();

            if (Template == null)
            {
                return;
            }

            LinePathObject = GetTemplatePart("PART_edgePath") as Path;
            if (LinePathObject == null)
            {
                throw new GX_ObjectNotFoundException("EdgeControlBase 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 EdgeControlBase template!");
            }

            EdgeLabelControl = 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);
                    }
                }
            }
            ;
            var x = this.ShowLabel;

            MeasureChild(EdgePointerForSource as UIElement);
            MeasureChild(EdgePointerForTarget as UIElement);
            MeasureChild(SelfLoopIndicator);
            //TODO measure label?

            UpdateSelfLoopedEdgeData();

            UpdateEdge();
        }
示例#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();
        }