Browse files

WPF Designer: use transaction when moving items in outline pad. (fixes

  • Loading branch information...
1 parent c67e7b2 commit 5df40bdd49b7e1e0f3868c03c485d0431ae2dd22 @dgrunwald dgrunwald committed Aug 29, 2011
View
31 src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNode.cs
@@ -156,25 +156,26 @@ public bool CanInsert(IEnumerable<OutlineNode> nodes, OutlineNode after, bool co
public void Insert(IEnumerable<OutlineNode> nodes, OutlineNode after, bool copy)
{
- if (copy) {
- nodes = nodes.Select(n => OutlineNode.Create(n.DesignItem.Clone()));
- }
- else {
- foreach (var node in nodes) {
- node.DesignItem.Remove();
+ using (var moveTransaction = DesignItem.Context.OpenGroup("Item moved in outline view", nodes.Select(n => n.DesignItem).ToList())) {
+ if (copy) {
+ nodes = nodes.Select(n => OutlineNode.Create(n.DesignItem.Clone())).ToList();
+ } else {
+ foreach (var node in nodes) {
+ node.DesignItem.Remove();
+ }
}
- }
- var index = after == null ? 0 : Children.IndexOf(after) + 1;
+ var index = after == null ? 0 : Children.IndexOf(after) + 1;
- var content = DesignItem.ContentProperty;
- if (content.IsCollection) {
- foreach (var node in nodes) {
- content.CollectionElements.Insert(index++, node.DesignItem);
+ var content = DesignItem.ContentProperty;
+ if (content.IsCollection) {
+ foreach (var node in nodes) {
+ content.CollectionElements.Insert(index++, node.DesignItem);
+ }
+ } else {
+ content.SetValue(nodes.First().DesignItem);
}
- }
- else {
- content.SetValue(nodes.First().DesignItem);
+ moveTransaction.Commit();
}
}
View
2 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentChangeEventArgs.cs
@@ -19,7 +19,7 @@ public class DocumentChangeEventArgs : EventArgs
public int Offset { get; private set; }
/// <summary>
- /// The text that was inserted.
+ /// The text that was removed.
/// </summary>
public string RemovedText { get; private set; }

0 comments on commit 5df40bd

Please sign in to comment.