private void BindToInkCanvas(DependencyProperty property) { Binding binding = new Binding(); binding.Source = this; binding.Path = new PropertyPath(property.Name); inkCanvas.SetBinding(property, binding); }
/// <summary/> protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); _inkCanvas = new InkCanvas(); _inkCanvas.SetBinding(InkCanvas.BackgroundProperty, this, "Background"); _inkCanvas.SetBinding(InkCanvas.DefaultDrawingAttributesProperty, this, "StylusAttributes"); _inkCanvas.EditingMode = InkCanvasEditingMode.GestureOnly; _inkCanvas.Gesture += _onGestureRecognition; IsGestureRecognizerAvailable = _inkCanvas.IsGestureRecognizerAvailable; _systemGestures = new HashSet<ApplicationGesture>(new[] { ApplicationGesture.Curlicue }); SystemGestures = _systemGestures; _updateEnabledGestures(); AddVisualChild(_inkCanvas); }