private static void StrokeBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CustomInkCanvas p = d as CustomInkCanvas; DrawingAttributes at = (DrawingAttributes)d.GetValue(CustomInkCanvas.DefaultDrawingAttributesProperty); at.Color = ((SolidColorBrush)e.NewValue).Color; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.test = ((InkCanvasTest.CustomInkCanvas)(target)); return; case 2: this.DrawSource = ((System.Windows.Controls.ListBox)(target)); return; case 3: this.editSource = ((System.Windows.Controls.ListBox)(target)); return; } this._contentLoaded = true; }
private static void DrawTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CustomInkCanvas o = d as CustomInkCanvas; switch ((DrawTypeEum)e.NewValue) { case DrawTypeEum.Ink: o.DynamicRenderer = o.CommonRender; break; case DrawTypeEum.Line: o.DynamicRenderer = o.LineRender; break; case DrawTypeEum.Rectangle: o.DynamicRenderer = o.RectangleRender; break; case DrawTypeEum.Ellipse: o.DynamicRenderer = o.ElipseRender; break; } }