From fb4e3c1e9868f3d4dfba82d2143415cb48504b20 Mon Sep 17 00:00:00 2001 From: Ivan Shumilin Date: Tue, 19 Aug 2008 05:53:06 +0000 Subject: [PATCH] - Resize snaplines bugfix - Async PropertyGrid.Reload() git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3426 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Extensions/SnaplinePlacementBehavior.cs | 10 +++++++--- .../Project/PropertyGrid/PropertyGrid.cs | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs index 099e52c341..96bfb095a3 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs @@ -96,8 +96,10 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions if (operation.Type == PlacementType.Resize) { if (info.ResizeThumbAlignment.Vertical == VerticalAlignment.Top) { bounds.Y += delta; + bounds.Height = Math.Max(0, bounds.Height - delta); + } else { + bounds.Height = Math.Max(0, bounds.Height + delta); } - bounds.Height = Math.Max(0, bounds.Height + delta); info.Bounds = bounds; } else { foreach (var item in operation.PlacedItems) { @@ -117,8 +119,10 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions if (operation.Type == PlacementType.Resize) { if (info.ResizeThumbAlignment.Horizontal == HorizontalAlignment.Left) { bounds.X += delta; - } - bounds.Width = Math.Max(0, bounds.Width + delta); + bounds.Width = Math.Max(0, bounds.Width - delta); + } else { + bounds.Width = Math.Max(0, bounds.Width + delta); + } info.Bounds = bounds; } else { foreach (var item in operation.PlacedItems) { diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGrid.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGrid.cs index fc8b87ea57..aca31637f1 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGrid.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGrid.cs @@ -7,6 +7,7 @@ using System.Collections.ObjectModel; using System.Threading; using System.Globalization; using ICSharpCode.WpfDesign.PropertyGrid; +using System.Windows.Threading; namespace ICSharpCode.WpfDesign.Designer.PropertyGrid { @@ -89,9 +90,11 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid return selectedItems; } set { - selectedItems = value; - Reload(); - RaisePropertyChanged("SelectedItems"); + Dispatcher.CurrentDispatcher.BeginInvoke(new Action(delegate { + selectedItems = value; + Reload(); + RaisePropertyChanged("SelectedItems"); + }), DispatcherPriority.Background); } }