private void UndoButton_Click(object sender, RoutedEventArgs e) { if (Strokes == null || Strokes.Count == 0) { return; } UndoneStrokes.Add(Strokes.ElementAt(Strokes.Count - 1)); Strokes.RemoveAt(Strokes.Count - 1); }