コード例 #1
0
        private static LineSegment CreateLineSegment <TArg1>(DependencyValue <TArg1> arg1, Func <TArg1, PointDouble> convertToPointFn)
        {
            LineSegment targetObject = new LineSegment();

            targetObject.SetBinding <TArg1, PointDouble>(LineSegment.PointProperty, arg1, new PaintDotNet.ObjectModel.PropertyPath(arg1.GetValueProperty().Name, Array.Empty <object>()), BindingMode.OneWay, convertToPointFn);
            return(targetObject);
        }
コード例 #2
0
        private static LineSegment CreateLineSegment <TArg1, TArg2>(DependencyValue <TArg1> arg1, DependencyValue <TArg2> arg2, Func <TArg1, TArg2, PointDouble> convertToPointFn)
        {
            LineSegment targetObject = new LineSegment();

            object[] sourceObjects = new object[] { arg1, arg2 };
            PaintDotNet.ObjectModel.PropertyPath[] sourcePaths = new PaintDotNet.ObjectModel.PropertyPath[] { new PaintDotNet.ObjectModel.PropertyPath(arg1.GetValueProperty().Name, Array.Empty <object>()), new PaintDotNet.ObjectModel.PropertyPath(arg2.GetValueProperty().Name, Array.Empty <object>()) };
            targetObject.SetMultiBinding(LineSegment.PointProperty, sourceObjects, sourcePaths, BindingMode.OneWay, values => convertToPointFn((TArg1)values[0], (TArg2)values[1]), null);
            return(targetObject);
        }
コード例 #3
0
        /// <summary>
        /// Compiles a <see cref="SetTriggerAction"/> from the specified syntax node.
        /// </summary>
        private static SetTriggerAction CompileSetTriggerAction(UvssSetTriggerActionSyntax node, CultureInfo culture)
        {
            var selector = node.Selector == null ? null :
                           CompileSelector(node.Selector);

            var propName  = new DependencyName(GetPropertyName(node.PropertyName));
            var propValue = new DependencyValue(node.Value.Value, culture);

            return(new SetTriggerAction(selector, propName, propValue));
        }
コード例 #4
0
        public CompassHandleDrawing()
        {
            this.bounds.SetBinding(DependencyFuncBase <double, RectDouble> .Arg1Property, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.EffectiveRadiusProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            this.outlinePen = new Pen();
            this.outlinePen.SetBinding(Pen.BrushProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.ForegroundProperty), BindingMode.OneWay);
            this.outlinePen.SetBinding(Pen.ThicknessProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.ThicknessProperty), BindingMode.OneWay);
            this.backFillDrawing     = new GeometryDrawing();
            this.backFillDrawing.Pen = this.outlinePen;
            this.backFillDrawing.SetBinding(GeometryDrawing.BrushProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.BackgroundProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            this.backFillGeometry = new RectangleGeometry();
            this.backFillGeometry.SetBinding(RectangleGeometry.RectProperty, this.bounds, new PaintDotNet.ObjectModel.PropertyPath(DependencyValue <RectDouble> .ValueProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            this.backFillDrawing.Geometry = this.backFillGeometry;
            base.DrawingGroup.Children.Add(this.backFillDrawing);
            this.compassDrawing = new GeometryDrawing();
            this.compassDrawing.SetBinding(GeometryDrawing.BrushProperty, this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.ForegroundProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            this.compassGeometry = new PathGeometry();
            this.s = new DependencyValue <double>();
            this.s.SetBinding(this.s.GetValueProperty(), this, new PaintDotNet.ObjectModel.PropertyPath(HandleDrawing.RadiusScaleProperty.Name, Array.Empty <object>()), BindingMode.OneWay);
            this.st            = new DependencyFunc <double, double>(s => s * 1.35, this.s);
            this.st3Over2      = new DependencyFunc <double, double>(st => (st * 3.0) / 2.0, this.st);
            this.sOver2        = new DependencyFunc <double, double>(s => s / 2.0, this.s);
            this.stSqrt27Over2 = new DependencyFunc <double, double>(st => (st * Math.Sqrt(27.0)) / 2.0, this.st);
            PathFigure targetObject = new PathFigure {
                IsFilled = true,
                IsClosed = true
            };

            targetObject.SetBinding <RectDouble, PointDouble>(PathFigure.StartPointProperty, this.bounds, new PaintDotNet.ObjectModel.PropertyPath(DependencyValue <RectDouble> .ValueProperty), BindingMode.OneWay, b => b.LeftCenter());
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.stSqrt27Over2, this.st3Over2, (bounds, stSqrt27Over2, st3over2) => new PointDouble(bounds.LeftCenter().X + stSqrt27Over2, bounds.LeftCenter().Y + st3over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.stSqrt27Over2, this.sOver2, (bounds, stSqrt27Over2, sOver2) => new PointDouble(bounds.LeftCenter().X + stSqrt27Over2, bounds.LeftCenter().Y + sOver2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double>(this.bounds, this.sOver2, (bounds, sOver2) => new PointDouble(bounds.Center.X - sOver2, bounds.Center.Y + sOver2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.sOver2, this.stSqrt27Over2, (bounds, sOver2, stSqrt27Over2) => new PointDouble(bounds.BottomCenter().X - sOver2, bounds.BottomCenter().Y - stSqrt27Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.st3Over2, this.stSqrt27Over2, (bounds, st3Over2, stSqrt27Over2) => new PointDouble(bounds.BottomCenter().X - st3Over2, bounds.BottomCenter().Y - stSqrt27Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble>(this.bounds, bounds => bounds.BottomCenter()));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.st3Over2, this.stSqrt27Over2, (bounds, st3Over2, stSqrt27Over2) => new PointDouble(bounds.BottomCenter().X + st3Over2, bounds.BottomCenter().Y - stSqrt27Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.sOver2, this.stSqrt27Over2, (bounds, sOver2, stSqrt27Over2) => new PointDouble(bounds.BottomCenter().X + sOver2, bounds.BottomCenter().Y - stSqrt27Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double>(this.bounds, this.sOver2, (bounds, sOver2) => new PointDouble(bounds.Center.X + sOver2, bounds.Center.Y + sOver2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.stSqrt27Over2, this.sOver2, (bounds, stSqrt27Over2, sOver2) => new PointDouble(bounds.RightCenter().X - stSqrt27Over2, bounds.RightCenter().Y + sOver2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.stSqrt27Over2, this.st3Over2, (bounds, stSqrt27Over2, st3Over2) => new PointDouble(bounds.RightCenter().X - stSqrt27Over2, bounds.RightCenter().Y + st3Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble>(this.bounds, bounds => bounds.RightCenter()));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.stSqrt27Over2, this.st3Over2, (bounds, stSqrt27Over2, st3Over2) => new PointDouble(bounds.RightCenter().X - stSqrt27Over2, bounds.RightCenter().Y - st3Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.stSqrt27Over2, this.sOver2, (bounds, stSqrt27Over2, sOver2) => new PointDouble(bounds.RightCenter().X - stSqrt27Over2, bounds.RightCenter().Y - sOver2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double>(this.bounds, this.sOver2, (bounds, sOver2) => new PointDouble(bounds.Center.X + sOver2, bounds.Center.Y - sOver2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.sOver2, this.stSqrt27Over2, (bounds, sOver2, stSqrt27Over2) => new PointDouble(bounds.TopCenter().X + sOver2, bounds.TopCenter().Y + stSqrt27Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.st3Over2, this.stSqrt27Over2, (bounds, st3Over2, stSqrt27Over2) => new PointDouble(bounds.TopCenter().X + st3Over2, bounds.TopCenter().Y + stSqrt27Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble>(this.bounds, bounds => bounds.TopCenter()));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.st3Over2, this.stSqrt27Over2, (bounds, st3Over2, stSqrt27Over2) => new PointDouble(bounds.TopCenter().X - st3Over2, bounds.TopCenter().Y + stSqrt27Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.sOver2, this.stSqrt27Over2, (bounds, sOver2, stSqrt27Over2) => new PointDouble(bounds.TopCenter().X - sOver2, bounds.TopCenter().Y + stSqrt27Over2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double>(this.bounds, this.sOver2, (bounds, sOver2) => new PointDouble(bounds.Center.X - sOver2, bounds.Center.Y - sOver2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.stSqrt27Over2, this.sOver2, (bounds, stSqrt27Over2, sOver2) => new PointDouble(bounds.LeftCenter().X + stSqrt27Over2, bounds.LeftCenter().Y - sOver2)));
            targetObject.Segments.Add(CreateLineSegment <RectDouble, double, double>(this.bounds, this.stSqrt27Over2, this.st3Over2, (bounds, stSqrt27Over2, st3Over2) => new PointDouble(bounds.LeftCenter().X + stSqrt27Over2, bounds.LeftCenter().Y - st3Over2)));
            this.compassGeometry.Figures.Add(targetObject);
            this.compassDrawing.Geometry = this.compassGeometry;
            base.DrawingGroup.Children.Add(this.compassDrawing);
        }
コード例 #5
0
        /// <summary>
        /// Compiles a <see cref="UvssStoryboardKeyframe"/> from the specified syntax node.
        /// </summary>
        private static UvssStoryboardKeyframe CompileStoryboardKeyframe(UvssAnimationKeyframeSyntax node, CultureInfo culture)
        {
            var time =
                Double.Parse(node.TimeToken.Text);

            var value =
                new DependencyValue(node.Value.Value, culture);

            var easing =
                node.EasingIdentifier?.Text;

            return(new UvssStoryboardKeyframe(time, value, easing));
        }
コード例 #6
0
        /// <summary>
        /// Compiles a <see cref="UvssPropertyTriggerCondition"/> from the specified syntax node.
        /// </summary>
        private static UvssPropertyTriggerCondition CompilePropertyTriggerCondition(UvssPropertyTriggerConditionSyntax node, CultureInfo culture)
        {
            var op            = default(TriggerComparisonOp);
            var propertyName  = new DependencyName(GetPropertyName(node.PropertyName));
            var propertyValue = new DependencyValue(node.PropertyValue.Value, culture);

            switch (node.ComparisonOperatorToken.Kind)
            {
            case SyntaxKind.EqualsToken:
                op = TriggerComparisonOp.Equals;
                break;

            case SyntaxKind.NotEqualsToken:
                op = TriggerComparisonOp.NotEquals;
                break;

            case SyntaxKind.GreaterThanToken:
                op = TriggerComparisonOp.GreaterThan;
                break;

            case SyntaxKind.LessThanToken:
                op = TriggerComparisonOp.LessThan;
                break;

            case SyntaxKind.GreaterThanEqualsToken:
                op = TriggerComparisonOp.GreaterThanOrEqualTo;
                break;

            case SyntaxKind.LessThanEqualsToken:
                op = TriggerComparisonOp.LessThanOrEqualTo;
                break;

            default:
                throw new UvssException(PresentationStrings.StyleSheetParserError);
            }

            return(new UvssPropertyTriggerCondition(op, propertyName, propertyValue));
        }
コード例 #7
0
 public BrushToolUIBase(string canvasMouseCursorUpResName)
 {
     ClickDragBehavior.SetIsEnabled(this, true);
     ClickDragBehavior.SetAllowClick(this, false);
     this.canvasMouseUpCursor = CursorUtil.LoadResource(canvasMouseCursorUpResName);
     this.mouseCenterPt       = new DependencyValue <PointDouble>();
     this.toolState           = new DependencyValue <TransactedToolState>();
     this.toolState.SetBinding(this.toolState.GetValueProperty(), this, new PaintDotNet.ObjectModel.PropertyPath(ToolUICanvas.ToolProperty.Name + ".State", Array.Empty <object>()), BindingMode.OneWay);
     this.toolState.ValueChanged += new ValueChangedEventHandler <TransactedToolState>(this.OnToolStateChanged);
     this.brushPreviewDrawing     = new CircleHandleDrawing();
     this.brushPreviewDrawing.AutoScaleWithDpi = false;
     this.brushPreviewElement = new HandleElement(this.brushPreviewDrawing);
     this.brushPreviewElement.IsHitTestVisible = false;
     this.brushPreviewElement.IsHotOnMouseOver = false;
     this.brushPreviewElementCanvasOffset      = new DependencyFunc <PointDouble, SizeDouble, PointDouble>(new Func <PointDouble, SizeDouble, PointDouble>(BrushToolUIBase <TDerived, TTool, TChanges> .GetHandleCanvasOffset));
     this.brushPreviewElementCanvasOffset.SetArgInput <PointDouble>(1, this.mouseCenterPt);
     this.brushPreviewElementCanvasOffset.SetArgInput(2, this.brushPreviewElement, new PaintDotNet.ObjectModel.PropertyPath(PaintDotNet.UI.FrameworkElement.ActualSizeProperty));
     this.brushPreviewElement.SetBinding(PaintDotNet.UI.Controls.Canvas.LeftProperty, this.brushPreviewElementCanvasOffset, new PaintDotNet.ObjectModel.PropertyPath("Value.X", Array.Empty <object>()), BindingMode.OneWay);
     this.brushPreviewElement.SetBinding(PaintDotNet.UI.Controls.Canvas.TopProperty, this.brushPreviewElementCanvasOffset, new PaintDotNet.ObjectModel.PropertyPath("Value.Y", Array.Empty <object>()), BindingMode.OneWay);
     this.brushPreviewElement.SetBinding(DrawingElement.ScaleProperty, this, PropertyPathUtil.Combine(ToolUICanvas.CanvasViewProperty, CanvasView.CanvasHairWidthProperty), BindingMode.OneWay);
     base.Children.Add(this.brushPreviewElement);
     base.Loaded   += new EventHandler(this.OnLoaded);
     base.Unloaded += new EventHandler(this.OnUnloaded);
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UvssPropertyTriggerCondition"/> class.
 /// </summary>
 /// <param name="op">A <see cref="TriggerComparisonOp"/> value that specifies the type of comparison performed by this condition.</param>
 /// <param name="propertyName">The name of the property to evaluate.</param>
 /// <param name="propertyValue">The value to compare to the value of the evaluated property.</param>
 internal UvssPropertyTriggerCondition(TriggerComparisonOp op, DependencyName propertyName, DependencyValue propertyValue)
 {
     this.op            = op;
     this.propertyName  = propertyName;
     this.propertyValue = propertyValue;
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UvssPropertyTriggerCondition"/> class.
 /// </summary>
 /// <param name="op">A <see cref="TriggerComparisonOp"/> value that specifies the type of comparison performed by this condition.</param>
 /// <param name="propertyName">The name of the property to evaluate.</param>
 /// <param name="propertyValue">The value to compare to the value of the evaluated property.</param>
 internal UvssPropertyTriggerCondition(TriggerComparisonOp op, DependencyName propertyName, DependencyValue propertyValue)
 {
     this.op = op;
     this.propertyName = propertyName;
     this.propertyValue = propertyValue;
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UvssStoryboardKeyframe"/> class.
 /// </summary>
 /// <param name="time">The keyframe's time in milliseconds.</param>
 /// <param name="value">The keyframe's value.</param>
 /// <param name="easing">The keyframe's easing.</param>
 internal UvssStoryboardKeyframe(Double time, DependencyValue value, String easing)
 {
     this.time   = time;
     this.value  = value;
     this.easing = easing;
 }
コード例 #11
0
        public FloodFillToolUIBase()
        {
            this.handCursor          = CursorUtil.LoadResource("Cursors.PanToolCursor.cur");
            this.handMouseDownCursor = CursorUtil.LoadResource("Cursors.PanToolCursorMouseDown.cur");
            this.toolState           = new DependencyValue <TransactedToolState>();
            this.toolState.SetBinding(this.toolState.GetValueProperty(), this, new PaintDotNet.ObjectModel.PropertyPath(ToolUICanvas.ToolProperty.Name + ".State", Array.Empty <object>()), BindingMode.OneWay);
            this.toolState.ValueChanged += new ValueChangedEventHandler <TransactedToolState>(this.OnToolStateChanged);
            this.canvasHandle            = new HandleElement();
            this.canvasHandle.Focusable  = true;
            FloodFillToolUIBase <TTool, TChanges> .SetHandleType(this.canvasHandle, FloodFillToolHandleType.Canvas);

            this.canvasHandle.ClipToBounds = false;
            ClickDragBehavior.SetAllowClick(this.canvasHandle, false);
            ClickDragBehavior.SetAllowDrag(this.canvasHandle, true);
            ClickDragBehavior.SetIsEnabled(this.canvasHandle, true);
            this.canvasHandle.SetBinding(PaintDotNet.UI.FrameworkElement.CursorProperty, this, new PaintDotNet.ObjectModel.PropertyPath(FloodFillToolUIBase <TTool, TChanges> .CanvasCursorProperty), BindingMode.OneWay);
            base.Children.Add(this.canvasHandle);
            this.originHandle = new HandleElement();
            FloodFillToolUIBase <TTool, TChanges> .SetHandleType(this.originHandle, FloodFillToolHandleType.Origin);

            ClickDragBehavior.SetAllowClick(this.originHandle, true);
            ClickDragBehavior.SetAllowDrag(this.originHandle, true);
            ClickDragBehavior.SetIsEnabled(this.originHandle, true);
            this.originHandle.SetBinding <TransactedToolState, Visibility>(UIElement.VisibilityProperty, this, new PaintDotNet.ObjectModel.PropertyPath("Tool.State", Array.Empty <object>()), BindingMode.OneWay, new Func <TransactedToolState, Visibility>(FloodFillToolUIBase <TTool, TChanges> .GetHandleVisibility));
            this.originDrawing = new SquareHandleDrawing();
            this.originDrawing.SetBinding <double, double>(HandleDrawing.RadiusProperty, this, PropertyPathUtil.Combine(ToolUICanvas.CanvasViewProperty, CanvasView.CanvasHairWidthProperty), BindingMode.OneWay, hw => (1.0 / hw) / 2.0);
            this.originHandle.Drawing     = this.originDrawing;
            this.originHandleCanvasOffset = new DependencyFunc <PointInt32, SizeDouble, PointDouble>(new Func <PointInt32, SizeDouble, PointDouble>(FloodFillToolUIBase <TTool, TChanges> .GetHandleCanvasOffset));
            this.originHandleCanvasOffset.SetArgInput(1, this, new PaintDotNet.ObjectModel.PropertyPath("Tool.Changes.OriginPointInt32", Array.Empty <object>()));
            this.originHandleCanvasOffset.SetArgInput(2, this.originHandle, new PaintDotNet.ObjectModel.PropertyPath(PaintDotNet.UI.FrameworkElement.ActualSizeProperty.Name, Array.Empty <object>()));
            this.originHandle.SetBinding(PaintDotNet.UI.Controls.Canvas.LeftProperty, this.originHandleCanvasOffset, new PaintDotNet.ObjectModel.PropertyPath("Value.X", Array.Empty <object>()), BindingMode.OneWay);
            this.originHandle.SetBinding(PaintDotNet.UI.Controls.Canvas.TopProperty, this.originHandleCanvasOffset, new PaintDotNet.ObjectModel.PropertyPath("Value.Y", Array.Empty <object>()), BindingMode.OneWay);
            this.originHandle.SetBinding(DrawingElement.ScaleProperty, this, PropertyPathUtil.Combine(ToolUICanvas.CanvasViewProperty, CanvasView.CanvasHairWidthProperty), BindingMode.OneWay);
            this.originHandle.SetBinding <double, PaintDotNet.UI.Thickness>(DrawingElement.PaddingProperty, this, PropertyPathUtil.Combine(ToolUICanvas.CanvasViewProperty, CanvasView.CanvasHairWidthProperty), BindingMode.OneWay, new Func <double, PaintDotNet.UI.Thickness>(FloodFillToolUIBase <TTool, TChanges> .GetHandlePadding));
            this.originHandle.SetBinding <TransactedToolState, Cursor>(PaintDotNet.UI.FrameworkElement.CursorProperty, this, new PaintDotNet.ObjectModel.PropertyPath("Tool.State", Array.Empty <object>()), BindingMode.OneWay, new Func <TransactedToolState, Cursor>(this.GetHandleCursor));
            base.Children.Add(this.originHandle);
            this.moveHandle = new HandleElement(new CompassHandleDrawing());
            FloodFillToolUIBase <TTool, TChanges> .SetHandleType(this.moveHandle, FloodFillToolHandleType.Move);

            ClickDragBehavior.SetAllowClick(this.moveHandle, true);
            ClickDragBehavior.SetAllowDrag(this.moveHandle, true);
            ClickDragBehavior.SetIsEnabled(this.moveHandle, true);
            this.moveHandle.SetBinding <TransactedToolState, Visibility>(UIElement.VisibilityProperty, this, new PaintDotNet.ObjectModel.PropertyPath("Tool.State", Array.Empty <object>()), BindingMode.OneWay, new Func <TransactedToolState, Visibility>(FloodFillToolUIBase <TTool, TChanges> .GetHandleVisibility));
            this.moveHandle.RenderTransformOrigin = new PointDouble(0.5, 0.5);
            this.moveHandleCanvasOffset           = new DependencyFunc <PointInt32, double, SizeDouble, PointDouble>(new Func <PointInt32, double, SizeDouble, PointDouble>(FloodFillToolUIBase <TTool, TChanges> .GetMoveHandleCanvasOffset));
            this.moveHandleCanvasOffset.SetArgInput(1, this, new PaintDotNet.ObjectModel.PropertyPath("Tool.Changes.OriginPointInt32", Array.Empty <object>()));
            this.moveHandleCanvasOffset.SetArgInput(2, this, PropertyPathUtil.Combine(ToolUICanvas.CanvasViewProperty, CanvasView.CanvasHairWidthProperty));
            this.moveHandleCanvasOffset.SetArgInput(3, this.moveHandle, new PaintDotNet.ObjectModel.PropertyPath(PaintDotNet.UI.FrameworkElement.ActualSizeProperty.Name, Array.Empty <object>()));
            this.moveHandle.SetBinding(PaintDotNet.UI.Controls.Canvas.LeftProperty, this.moveHandleCanvasOffset, new PaintDotNet.ObjectModel.PropertyPath("Value.X", Array.Empty <object>()), BindingMode.OneWay);
            this.moveHandle.SetBinding(PaintDotNet.UI.Controls.Canvas.TopProperty, this.moveHandleCanvasOffset, new PaintDotNet.ObjectModel.PropertyPath("Value.Y", Array.Empty <object>()), BindingMode.OneWay);
            this.moveHandle.SetBinding(DrawingElement.ScaleProperty, this, PropertyPathUtil.Combine(ToolUICanvas.CanvasViewProperty, CanvasView.CanvasHairWidthProperty), BindingMode.OneWay);
            this.moveHandle.SetBinding <double, PaintDotNet.UI.Thickness>(DrawingElement.PaddingProperty, this, PropertyPathUtil.Combine(ToolUICanvas.CanvasViewProperty, CanvasView.CanvasHairWidthProperty), BindingMode.OneWay, new Func <double, PaintDotNet.UI.Thickness>(FloodFillToolUIBase <TTool, TChanges> .GetHandlePadding));
            this.moveHandle.SetBinding <TransactedToolState, Cursor>(PaintDotNet.UI.FrameworkElement.CursorProperty, this, new PaintDotNet.ObjectModel.PropertyPath("Tool.State", Array.Empty <object>()), BindingMode.OneWay, new Func <TransactedToolState, Cursor>(this.GetHandleCursor));
            this.moveHandleOpacityHelper                   = new AnimationStateHelper();
            this.moveHandleOpacityHelper.Element           = this.moveHandle;
            this.moveHandleOpacityHelper.EnableAnimations += delegate(object <sender>, EventArgs <e>) {
                base.moveHandleOpacity = new AnimatedDouble(1.0);
                base.moveHandle.SetBinding(UIElement.OpacityProperty, base.moveHandleOpacity, new PaintDotNet.ObjectModel.PropertyPath(AnimatedValue <double> .ValuePropertyName, Array.Empty <object>()), BindingMode.OneWay);
                base.moveHandleOpacity.AnimateRawValue((s, v) => FloodFillToolUIBase <TTool, TChanges> .InitializeHandleOpacityStoryboard(s, v, 0.33333333333333331), null);
            };
            this.moveHandleOpacityHelper.DisableAnimations += delegate(object <sender>, EventArgs <e>) {
                base.moveHandle.ClearBinding(UIElement.OpacityProperty);
                DisposableUtil.Free <AnimatedDouble>(ref this.moveHandleOpacity);
            };
            base.Children.Add(this.moveHandle);
            base.Loaded += new EventHandler(this.OnLoaded);
        }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UvssStoryboardKeyframe"/> class.
 /// </summary>
 /// <param name="time">The keyframe's time in milliseconds.</param>
 /// <param name="value">The keyframe's value.</param>
 /// <param name="easing">The keyframe's easing.</param>
 internal UvssStoryboardKeyframe(Double time, DependencyValue value, String easing)
 {
     this.time = time;
     this.value = value;
     this.easing = easing;
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SetTriggerAction"/> class.
 /// </summary>
 /// <param name="selector">A UVSS selector which specifies the target (or targets) of the action.</param>
 /// <param name="propertyName">The styling name of the dependency property which is set by this action.</param>
 /// <param name="propertyValue">The value to which the action sets its associated dependency property.</param>
 internal SetTriggerAction(UvssSelector selector, DependencyName propertyName, DependencyValue propertyValue)
 {
     this.selector      = selector;
     this.propertyName  = propertyName;
     this.propertyValue = propertyValue;
 }