diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs index 3b2a7845f5..ded6791a92 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs @@ -137,7 +137,6 @@ namespace ICSharpCode.WpfDesign.Designer DesignContext _context; readonly EatAllHitTestRequests _eatAllHitTestRequests; readonly AdornerLayer _adornerLayer; - readonly Canvas _markerCanvas; public DesignPanel() { @@ -148,10 +147,12 @@ namespace ICSharpCode.WpfDesign.Designer DesignerProperties.SetIsInDesignMode(this, true); _eatAllHitTestRequests = new EatAllHitTestRequests(); + _eatAllHitTestRequests.MouseDown += delegate { + // ensure the design panel has focus while the user is interacting with it + this.Focus(); + }; _eatAllHitTestRequests.AllowDrop = true; _adornerLayer = new AdornerLayer(this); - _markerCanvas = new Canvas(); - _markerCanvas.IsHitTestVisible = false; } #endregion @@ -201,12 +202,10 @@ namespace ICSharpCode.WpfDesign.Designer // remove _adornerLayer and _eatAllHitTestRequests RemoveVisualChild(_adornerLayer); RemoveVisualChild(_eatAllHitTestRequests); - RemoveVisualChild(_markerCanvas); } else if (base.Child == null) { // Child is being set from null to some value AddVisualChild(_adornerLayer); AddVisualChild(_eatAllHitTestRequests); - AddVisualChild(_markerCanvas); } base.Child = value; } @@ -221,8 +220,6 @@ namespace ICSharpCode.WpfDesign.Designer return _eatAllHitTestRequests; else if (index == 2) return _adornerLayer; - else if (index == 3) - return _markerCanvas; } return base.GetVisualChild(index); } @@ -230,7 +227,7 @@ namespace ICSharpCode.WpfDesign.Designer protected override int VisualChildrenCount { get { if (base.Child != null) - return 4; + return 3; else return base.VisualChildrenCount; } @@ -242,7 +239,6 @@ namespace ICSharpCode.WpfDesign.Designer if (this.Child != null) { _adornerLayer.Measure(constraint); _eatAllHitTestRequests.Measure(constraint); - _markerCanvas.Measure(constraint); } return result; } @@ -254,7 +250,6 @@ namespace ICSharpCode.WpfDesign.Designer Rect r = new Rect(new Point(0, 0), arrangeSize); _adornerLayer.Arrange(r); _eatAllHitTestRequests.Arrange(r); - _markerCanvas.Arrange(r); } return result; } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs index 6ccd6ed7b8..768272b8e1 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs @@ -86,12 +86,18 @@ namespace ICSharpCode.WpfDesign.Designer #region Command: Delete void OnDeleteExecuted(object sender, ExecutedRoutedEventArgs e) { - + if (_designContext != null) { + ModelTools.DeleteComponents(_designContext.Services.Selection.SelectedItems); + } } void OnDeleteCanExecute(object sender, CanExecuteRoutedEventArgs e) { - + if (_designContext != null) { + e.CanExecute = ModelTools.CanDeleteComponents(_designContext.Services.Selection.SelectedItems); + } else { + e.CanExecute = false; + } } #endregion diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs index 8f1d92d98e..c800581d1e 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs @@ -34,7 +34,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions /// public bool CanPlace(ICollection child, PlacementType type, PlacementAlignment position) { - return type == PlacementType.Resize || type == PlacementType.Move || type == PlacementType.Delete; + return type == PlacementType.Resize || type == PlacementType.Move + || type == PlacementType.Delete + || type == PlacementType.AddItem; } /// @@ -84,7 +86,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions /// public void BeginPlacement(PlacementOperation op) { - GrayOutDesignerExceptActiveArea.Start(ref grayOut, this.Services, this.ExtendedItem.View); + if (op.Type == PlacementType.Move || op.Type == PlacementType.Resize) { + GrayOutDesignerExceptActiveArea.Start(ref grayOut, this.Services, this.ExtendedItem.View); + } } /// diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs index b44ac239b4..e9c70fd2f9 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs @@ -39,14 +39,14 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions this.Adorners.Add(adornerPanel); resizeThumbs = new ResizeThumb[] { - CreateThumb(PlacementAlignments.TopLeft, Cursors.SizeNWSE), - CreateThumb(PlacementAlignments.Top, Cursors.SizeNS), - CreateThumb(PlacementAlignments.TopRight, Cursors.SizeNESW), - CreateThumb(PlacementAlignments.Left, Cursors.SizeWE), - CreateThumb(PlacementAlignments.Right, Cursors.SizeWE), - CreateThumb(PlacementAlignments.BottomLeft, Cursors.SizeNESW), - CreateThumb(PlacementAlignments.Bottom, Cursors.SizeNS), - CreateThumb(PlacementAlignments.BottomRight, Cursors.SizeNWSE) + CreateThumb(PlacementAlignment.TopLeft, Cursors.SizeNWSE), + CreateThumb(PlacementAlignment.Top, Cursors.SizeNS), + CreateThumb(PlacementAlignment.TopRight, Cursors.SizeNESW), + CreateThumb(PlacementAlignment.Left, Cursors.SizeWE), + CreateThumb(PlacementAlignment.Right, Cursors.SizeWE), + CreateThumb(PlacementAlignment.BottomLeft, Cursors.SizeNESW), + CreateThumb(PlacementAlignment.Bottom, Cursors.SizeNS), + CreateThumb(PlacementAlignment.BottomRight, Cursors.SizeNWSE) }; } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/WindowResizeBehavior.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/WindowResizeBehavior.cs index baeeeae731..558138c9c9 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/WindowResizeBehavior.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/WindowResizeBehavior.cs @@ -29,9 +29,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions public bool CanPlace(ICollection children, PlacementType type, PlacementAlignment position) { return type == PlacementType.Resize && - (position == PlacementAlignments.Right - || position == PlacementAlignments.BottomRight - || position == PlacementAlignments.Bottom); + (position == PlacementAlignment.Right + || position == PlacementAlignment.BottomRight + || position == PlacementAlignment.Bottom); } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs index b392c88214..0d6c420f96 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs @@ -6,6 +6,7 @@ // using System; +using System.Collections.Generic; using System.Windows; namespace ICSharpCode.WpfDesign.Designer @@ -43,6 +44,32 @@ namespace ICSharpCode.WpfDesign.Designer return 0; } + /// + /// Gets if the specified components can be deleted. + /// + public static bool CanDeleteComponents(ICollection items) + { + IPlacementBehavior b = PlacementOperation.GetPlacementBehavior(items); + return b != null + && b.CanPlace(items, PlacementType.Delete, PlacementAlignment.Center); + } + + /// + /// Deletes the specified components from their parent containers. + /// If the deleted components are currently selected, they are deselected before they are deleted. + /// + public static void DeleteComponents(ICollection items) + { + PlacementOperation operation = PlacementOperation.Start(items, PlacementType.Delete); + try { + Func.First(items).Services.Selection.SetSelectedComponents(items, SelectionTypes.Remove); + operation.DeleteItemsAndCommit(); + } catch { + operation.Abort(); + throw; + } + } + internal static Size GetDefaultSize(DesignItem createdItem) { return new Size(GetWidth(createdItem.View), GetHeight(createdItem.View)); diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/CreateComponentTool.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/CreateComponentTool.cs index 18035c8d93..df4230ab60 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/CreateComponentTool.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/CreateComponentTool.cs @@ -64,7 +64,7 @@ namespace ICSharpCode.WpfDesign.Designer.Services /// protected virtual DesignItem CreateItem(DesignContext context) { - object newInstance = Activator.CreateInstance(componentType); + object newInstance = context.Services.ExtensionManager.CreateInstanceWithCustomInstanceFactory(componentType, null); return context.Services.Component.RegisterComponentForDesigner(newInstance); } @@ -104,7 +104,7 @@ namespace ICSharpCode.WpfDesign.Designer.Services container, new DesignItem[] { createdItem }, new Rect[] { new Rect(position, ModelTools.GetDefaultSize(createdItem)) }, - PlacementType.Move + PlacementType.AddItem ); if (operation != null) { container.Services.Selection.SetSelectedComponents(new DesignItem[] { createdItem }); @@ -124,9 +124,6 @@ namespace ICSharpCode.WpfDesign.Designer.Services if (result.ModelHit != null) { IPlacementBehavior behavior = result.ModelHit.GetBehavior(); if (behavior != null) { - // ensure the design panel has the focus - otherwise pressing Escape to abort creating doesn't work - designPanel.Focus(); - DesignItem createdItem = CreateItem(designPanel.Context); new CreateComponentMouseGesture(result.ModelHit, createdItem).Start(designPanel, e); diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/DragMoveMouseGesture.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/DragMoveMouseGesture.cs index 244faac7c8..3290d764b4 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/DragMoveMouseGesture.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/DragMoveMouseGesture.cs @@ -42,7 +42,7 @@ namespace ICSharpCode.WpfDesign.Designer.Services protected override void OnDragStarted(MouseEventArgs e) { IPlacementBehavior b = PlacementOperation.GetPlacementBehavior(selectedItems); - if (b != null && b.CanPlace(selectedItems, PlacementType.Move, PlacementAlignments.TopLeft)) { + if (b != null && b.CanPlace(selectedItems, PlacementType.Move, PlacementAlignment.TopLeft)) { List sortedSelectedItems = new List(selectedItems); sortedSelectedItems.Sort(ModelTools.ComparePositionInModelFile); selectedItems = sortedSelectedItems; diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/MouseGestureBase.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/MouseGestureBase.cs index 969a64f607..48dcb86418 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/MouseGestureBase.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Services/MouseGestureBase.cs @@ -45,7 +45,6 @@ namespace ICSharpCode.WpfDesign.Designer.Services isStarted = true; this.designPanel = designPanel; this.services = designPanel.Context.Services; - designPanel.IsAdornerLayerHitTestVisible = false; if (designPanel.CaptureMouse()) { RegisterEvents(); OnStarted(e); @@ -104,7 +103,6 @@ namespace ICSharpCode.WpfDesign.Designer.Services isStarted = false; designPanel.ReleaseMouseCapture(); UnRegisterEvents(); - designPanel.IsAdornerLayerHitTestVisible = true; OnStopped(); } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignContext.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignContext.cs index 27f1e48794..7943d6a9e1 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignContext.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlDesignContext.cs @@ -55,22 +55,11 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml propertyGridEditorManager.RegisterAssembly(typeof(XamlDesignContext).Assembly); XamlParserSettings xamlParseSettings = new XamlParserSettings(); - xamlParseSettings.CreateInstanceCallback = OnXamlParserCreateInstance; + xamlParseSettings.CreateInstanceCallback = this.Services.ExtensionManager.CreateInstanceWithCustomInstanceFactory; _doc = XamlParser.Parse(xamlReader, xamlParseSettings); _rootItem = _componentService.RegisterXamlComponentRecursive(_doc.RootElement); } - object OnXamlParserCreateInstance(Type instanceType, object[] arguments) - { - foreach (Type extensionType in this.Services.ExtensionManager.GetExtensionTypes(instanceType)) { - if (typeof(CustomInstanceFactory).IsAssignableFrom(extensionType)) { - CustomInstanceFactory factory = (CustomInstanceFactory)Activator.CreateInstance(extensionType); - return factory.CreateInstance(instanceType, arguments); - } - } - return CustomInstanceFactory.DefaultInstanceFactory.CreateInstance(instanceType, arguments); - } - /// /// Saves the XAML DOM into the XML writer. /// diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionManager.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionManager.cs index 2a540d8759..ef44f0702b 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionManager.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/Extensions/ExtensionManager.cs @@ -98,6 +98,8 @@ namespace ICSharpCode.WpfDesign.Extensions /// public IEnumerable GetExtensionTypes(Type extendedItemType) { + if (extendedItemType == null) + throw new ArgumentNullException("extendedItemType"); foreach (ExtensionEntry entry in GetExtensionEntries(extendedItemType)) { yield return entry.ExtensionType; } @@ -194,6 +196,9 @@ namespace ICSharpCode.WpfDesign.Extensions /// public ExtensionServer GetExtensionServer(ExtensionServerAttribute attribute) { + if (attribute == null) + throw new ArgumentNullException("attribute"); + Type extensionServerType = attribute.ExtensionServerType; ExtensionServer server; @@ -209,5 +214,27 @@ namespace ICSharpCode.WpfDesign.Extensions return server; } #endregion + + #region Special extensions (Instance Factory) + /// + /// Create an instance of the specified type using the specified arguments. + /// The instance is created using a CustomInstanceFactory registered for the type, + /// or using reflection if no instance factory is found. + /// + public object CreateInstanceWithCustomInstanceFactory(Type instanceType, object[] arguments) + { + if (instanceType == null) + throw new ArgumentNullException("instanceType"); + if (arguments == null) + arguments = new object[0]; + foreach (Type extensionType in GetExtensionTypes(instanceType)) { + if (typeof(CustomInstanceFactory).IsAssignableFrom(extensionType)) { + CustomInstanceFactory factory = (CustomInstanceFactory)Activator.CreateInstance(extensionType); + return factory.CreateInstance(instanceType, arguments); + } + } + return CustomInstanceFactory.DefaultInstanceFactory.CreateInstance(instanceType, arguments); + } + #endregion } } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementAlignment.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementAlignment.cs index 0748e00d7e..601aab7b3e 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementAlignment.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementAlignment.cs @@ -81,13 +81,8 @@ namespace ICSharpCode.WpfDesign return !(lhs.Equals(rhs)); } #endregion - } - - /// - /// Contains known PlacementAlignment values like an enumeration. - /// - public static class PlacementAlignments - { + + /// Top left public static readonly PlacementAlignment TopLeft = new PlacementAlignment(HorizontalAlignment.Left, VerticalAlignment.Top); /// Top center diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs index 30d20be262..8a24b75513 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs @@ -82,9 +82,14 @@ namespace ICSharpCode.WpfDesign { if (newContainer == null) throw new ArgumentNullException("newContainer"); + if (isAborted || isCommitted) + throw new InvalidOperationException("The operation is not running anymore."); if (currentContainer == newContainer) return; + if (!currentContainerBehavior.CanLeaveContainer(this)) + throw new NotSupportedException("The items cannot be removed from their parent container."); + try { currentContainerBehavior.LeaveContainer(this); @@ -107,6 +112,22 @@ namespace ICSharpCode.WpfDesign } #endregion + #region Delete Items + /// + /// Deletes the items being placed, and commits the placement operation. + /// + public void DeleteItemsAndCommit() + { + if (isAborted || isCommitted) + throw new InvalidOperationException("The operation is not running anymore."); + if (!currentContainerBehavior.CanLeaveContainer(this)) + throw new NotSupportedException("The items cannot be removed from their parent container."); + + currentContainerBehavior.LeaveContainer(this); + Commit(); + } + #endregion + #region Start /// /// Starts a new placement operation that changes the placement of . diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementType.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementType.cs index 5c4703aa21..7df7171dc2 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementType.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementType.cs @@ -15,17 +15,24 @@ namespace ICSharpCode.WpfDesign public sealed class PlacementType { /// - /// Placement is done by resizing an element. + /// Placement is done by resizing an element in a drag'n'drop operation. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly PlacementType Resize = Register("Resize"); /// - /// Placement is done by moving an element. + /// Placement is done by moving an element in a drag'n'drop operation. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] public static readonly PlacementType Move = Register("Move"); + /// + /// Adding an element to a specified position in the container. + /// T + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] + public static readonly PlacementType AddItem = Register("AddItem"); + /// /// Not a "real" placement, but deleting the element. /// diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/DesignItemDataSource.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/DesignItemDataSource.cs index 461bf3af58..5dd0559c2a 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/DesignItemDataSource.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/DesignItemDataSource.cs @@ -98,7 +98,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor sources[i++] = GetDataSourceForDesignItem(item); } - return MultiSelectionDataSource.CreateDataSource(context != null ? context.Services : null, sources); + return MultipleSelectionDataSource.CreateDataSource(context != null ? context.Services : null, sources); } /// diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/FallbackEditor.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/FallbackEditor.cs index 5240efd011..463c807492 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/FallbackEditor.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/FallbackEditor.cs @@ -36,6 +36,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor OnValueChanged(null, null); } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] void OnValueChanged(object sender, EventArgs e) { if (property.IsSet) { diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/IPropertyEditorDataSource.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/IPropertyEditorDataSource.cs index 6c47bfa0ea..40af4c113c 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/IPropertyEditorDataSource.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/IPropertyEditorDataSource.cs @@ -93,7 +93,8 @@ namespace ICSharpCode.WpfDesign.PropertyEditor /// Gets the description of the property. The returned object should be something that /// can be used as Content for a WPF tooltip. /// - object GetDescription(); + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] + object GetDescription(); // is not a property because it can create a new instance on every call /// /// Gets/Sets if the property has been assigned a local value. diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultiSelectionDataProperty.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultipleSelectionDataProperty.cs similarity index 95% rename from src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultiSelectionDataProperty.cs rename to src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultipleSelectionDataProperty.cs index bd2a6b6765..ae116c789e 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultiSelectionDataProperty.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultipleSelectionDataProperty.cs @@ -10,12 +10,12 @@ using System.Diagnostics; namespace ICSharpCode.WpfDesign.PropertyEditor { - sealed class MultiSelectionDataProperty : IPropertyEditorDataProperty + sealed class MultipleSelectionDataProperty : IPropertyEditorDataProperty { - readonly MultiSelectionDataSource ownerDataSource; + readonly MultipleSelectionDataSource ownerDataSource; readonly IPropertyEditorDataProperty[] data; - public MultiSelectionDataProperty(MultiSelectionDataSource ownerDataSource, IPropertyEditorDataProperty[] data) + public MultipleSelectionDataProperty(MultipleSelectionDataSource ownerDataSource, IPropertyEditorDataProperty[] data) { Debug.Assert(ownerDataSource != null); Debug.Assert(data != null); diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultiSelectionDataSource.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultipleSelectionDataSource.cs similarity index 91% rename from src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultiSelectionDataSource.cs rename to src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultipleSelectionDataSource.cs index 7f9bd5a2dc..323ac3994d 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultiSelectionDataSource.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/MultipleSelectionDataSource.cs @@ -13,7 +13,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor /// /// Implements IPropertyEditorDataSource by combining the information from multiple data sources. /// - public sealed class MultiSelectionDataSource : IPropertyEditorDataSource + public sealed class MultipleSelectionDataSource : IPropertyEditorDataSource { /// /// Creates a data source for a collection of data sources. @@ -35,7 +35,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor } throw new InvalidOperationException(); } else { - return new MultiSelectionDataSource(services, sources); + return new MultipleSelectionDataSource(services, sources); } } @@ -47,7 +47,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor /// /// Creates a new MultiSelectionDataSource instance. /// - public MultiSelectionDataSource(ServiceContainer services, ICollection sources) + public MultipleSelectionDataSource(ServiceContainer services, ICollection sources) { this.services = services; if (sources == null) @@ -73,7 +73,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor } if (properties != null) { - this.properties.Add(new MultiSelectionDataProperty(this, properties)); + this.properties.Add(new MultipleSelectionDataProperty(this, properties)); } } } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/TextBoxEditor.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/TextBoxEditor.cs index 9392c5883c..dfbef0c25b 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/TextBoxEditor.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyEditor/TextBoxEditor.cs @@ -93,6 +93,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor base.OnTextChanged(e); } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] protected override void OnLostFocus(RoutedEventArgs e) { if (isDirty) { @@ -113,6 +114,7 @@ namespace ICSharpCode.WpfDesign.PropertyEditor base.OnLostFocus(e); } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] protected override void OnKeyDown(KeyEventArgs e) { base.OnKeyDown(e); diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/WpfDesign.csproj b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/WpfDesign.csproj index 9278eeabf3..ccbc2d5529 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/WpfDesign.csproj +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/WpfDesign.csproj @@ -89,14 +89,14 @@ - + - +