private void btnFormat_Click(object sender, RoutedEventArgs e) { StylusSettings dlg = new StylusSettings(); dlg.Owner = this; // Try getting the DrawingAttributes of the first selected stroke. StrokeCollection strokes = this.inkCanv.GetSelectedStrokes(); if (strokes.Count > 0) { dlg.DrawingAttributes = strokes[0].DrawingAttributes; } else { dlg.DrawingAttributes = this.inkCanv.DefaultDrawingAttributes; } if ((bool)dlg.ShowDialog().GetValueOrDefault()) { // Set the DrawingAttributes of all the selected strokes. foreach (Stroke strk in strokes) { strk.DrawingAttributes = dlg.DrawingAttributes; } } }
private void btnStylusSettings_Click(object sender, RoutedEventArgs e) { StylusSettings dlg = new StylusSettings(); dlg.Owner = this; dlg.DrawingAttributes = this.inkCanv.DefaultDrawingAttributes; if ((bool)dlg.ShowDialog().GetValueOrDefault()) { this.inkCanv.DefaultDrawingAttributes = dlg.DrawingAttributes; } }