private void OnDocumentPageChanged(object sender, Data.EventHandler.ActivePageChangedEventArgs e) { this.InkCanvas.Strokes.Clear(); this.InkCanvas.Children.Clear(); this.InvokePropertyChanged(() => this.InkCanvas); this.InvokePropertyChanged(() => this.CurrentPageNumber); this.InvokePropertyChanged(() => this.PageCount); if (e.ActivePage == null || e.ActivePage.StrokeData == null) { return; } using (MemoryStream memoryStream = new MemoryStream()) { memoryStream.Write(e.ActivePage.StrokeData, 0, e.ActivePage.StrokeData.Length); memoryStream.Seek(0, SeekOrigin.Begin); StrokeCollection collection = new StrokeCollection(memoryStream); this.InkCanvas.Strokes = collection; foreach (System.Windows.Ink.Stroke stroke in this.InkCanvas.Strokes) { if (stroke.DrawingAttributes.Color == SubstitutionColor) { stroke.DrawingAttributes.Color = Colors.LightGray; } } } foreach (UIElement uiElement in e.ActivePage.CreateChildren()) { this.InkCanvas.Children.Add(uiElement); } }
private void OnDocumentPageChanged(object sender, Data.EventHandler.ActivePageChangedEventArgs e) { this.CanExecuteChanged?.Invoke(this, new EventArgs()); }