diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs index 922e359e91..4f4ac2d93b 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs @@ -141,7 +141,8 @@ namespace ICSharpCode.WpfDesign.Designer public DesignPanel() { this.Focusable = true; - this.AllowDrop = true; + this.AllowDrop = false; + this.ClipToBounds = true; DesignerProperties.SetIsInDesignMode(this, true); _eatAllHitTestRequests = new EatAllHitTestRequests(); diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml index 3fafb8deed..f86ead6d44 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml @@ -204,7 +204,7 @@ VerticalAlignment="Center" Margin="7 0 0 0" ToolTip="{Binding Description}" - FontWeight="{Binding FontWeight}" + FontWeight="{Binding IsSet, Converter={x:Static Converters:BoldWhenTrue.Instance}}" Foreground="{Binding NameForeground}" /> diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementBehavior.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementBehavior.cs index b51c715ed3..e99bd92cf2 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementBehavior.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementBehavior.cs @@ -73,6 +73,8 @@ namespace ICSharpCode.WpfDesign /// Behavior interface for root elements (elements where item.Parent is null). /// Is used instead of to support resizing the root element. /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces", + Justification = "The root component might have both a PlacementBehavior and a RootPlacementBehavior, which must be distinguished by DesignItem.GetBehavior")] public interface IRootPlacementBehavior : IPlacementBehavior { } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs index faeda48532..512858f991 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementInformation.cs @@ -55,6 +55,9 @@ namespace ICSharpCode.WpfDesign set { bounds = value; } } + /// + /// Gets/sets the alignment of the resize thumb used to start the operation. + /// public PlacementAlignment ResizeThumbAlignment { get; set; } /// diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs index 8b5c675382..f5b10de595 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PlacementOperation.cs @@ -114,7 +114,7 @@ namespace ICSharpCode.WpfDesign } } - Rect TransformRectByMiddlePoint(GeneralTransform transform, Rect r) + static Rect TransformRectByMiddlePoint(GeneralTransform transform, Rect r) { // we don't want to adjust the size of the control when moving it out of a scaled // container, we just want to move it correcly diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/PropertyNode.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/PropertyNode.cs index 2f45708651..cfdf509e3b 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/PropertyNode.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/PropertyGrid/PropertyNode.cs @@ -158,6 +158,9 @@ namespace ICSharpCode.WpfDesign.PropertyGrid } } + /// + /// Gets whether the property node is enabled for editing. + /// public bool IsEnabled { get { return ValueItem == null && hasStringConverter; @@ -175,20 +178,18 @@ namespace ICSharpCode.WpfDesign.PropertyGrid return false; } } - - public FontWeight FontWeight { - get { - return IsSet ? FontWeights.Bold : FontWeights.Normal; - } - } - + + /// + /// Gets the color of the name. + /// Depends on the type of the value (binding/resource/etc.) + /// public Brush NameForeground { get { if (ValueItem != null) { - if (ValueItem.Component is BindingBase) + object component = ValueItem.Component; + if (component is BindingBase) return Brushes.DarkGoldenrod; - if (ValueItem.Component is StaticResourceExtension || - ValueItem.Component is DynamicResourceExtension) + if (component is StaticResourceExtension || component is DynamicResourceExtension) return Brushes.DarkGreen; } return SystemColors.WindowTextBrush; @@ -252,6 +253,9 @@ namespace ICSharpCode.WpfDesign.PropertyGrid SetValueCore(Unset); } + /// + /// Replaces the value of this node with a new binding. + /// public void CreateBinding() { Value = new Binding(); @@ -308,7 +312,10 @@ namespace ICSharpCode.WpfDesign.PropertyGrid this.Level = parent == null ? 0 : parent.Level + 1; Load(properties); } - + + /// + /// Initializes this property node with the specified properties. + /// public void Load(DesignItemProperty[] properties) { if (this.Properties != null) { @@ -375,6 +382,9 @@ namespace ICSharpCode.WpfDesign.PropertyGrid #region INotifyPropertyChanged Members + /// + /// Occurs when a property has changed. Used to support WPF data binding. + /// public event PropertyChangedEventHandler PropertyChanged; void RaisePropertyChanged(string name) diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/ServiceRequiredException.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/ServiceRequiredException.cs index e6b1458072..1d8d3320b3 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/ServiceRequiredException.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign/Project/ServiceRequiredException.cs @@ -7,6 +7,7 @@ using System; using System.Runtime.Serialization; +using System.Security.Permissions; namespace ICSharpCode.WpfDesign { @@ -25,7 +26,7 @@ namespace ICSharpCode.WpfDesign /// Create a new ServiceRequiredException instance. /// public ServiceRequiredException(Type serviceType) - : this("Service " + serviceType.FullName + " is required.") + : base("Service " + serviceType.FullName + " is required.") { this.ServiceType = serviceType; } @@ -57,6 +58,19 @@ namespace ICSharpCode.WpfDesign protected ServiceRequiredException(SerializationInfo info, StreamingContext context) : base(info, context) { + if (info == null) + throw new ArgumentNullException("info"); + this.ServiceType = (Type)info.GetValue("ServiceType", typeof(Type)); + } + + /// + [SecurityPermission(SecurityAction.Demand, SerializationFormatter=true)] + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + if (info == null) + throw new ArgumentNullException("info"); + base.GetObjectData(info, context); + info.AddValue("ServiceType", this.ServiceType); } } }