|
|
|
@ -38,27 +38,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
@@ -38,27 +38,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
|
|
|
|
|
[ExtensionFor(typeof(Viewbox))] |
|
|
|
|
public class DefaultPlacementBehavior : BehaviorExtension, IPlacementBehavior |
|
|
|
|
{ |
|
|
|
|
static List<Type> _contentControlsNotAllowedToAdd; |
|
|
|
|
|
|
|
|
|
static DefaultPlacementBehavior() |
|
|
|
|
{ |
|
|
|
|
_contentControlsNotAllowedToAdd = new List<Type>(); |
|
|
|
|
_contentControlsNotAllowedToAdd.Add(typeof (Frame)); |
|
|
|
|
_contentControlsNotAllowedToAdd.Add(typeof (GroupItem)); |
|
|
|
|
_contentControlsNotAllowedToAdd.Add(typeof (HeaderedContentControl)); |
|
|
|
|
_contentControlsNotAllowedToAdd.Add(typeof (Label)); |
|
|
|
|
_contentControlsNotAllowedToAdd.Add(typeof (ListBoxItem)); |
|
|
|
|
//_contentControlsNotAllowedToAdd.Add(typeof (ButtonBase));
|
|
|
|
|
_contentControlsNotAllowedToAdd.Add(typeof (StatusBarItem)); |
|
|
|
|
_contentControlsNotAllowedToAdd.Add(typeof (ToolTip)); |
|
|
|
|
} |
|
|
|
|
{ } |
|
|
|
|
|
|
|
|
|
public static bool CanContentControlAdd(ContentControl control) |
|
|
|
|
{ |
|
|
|
|
Debug.Assert(control != null); |
|
|
|
|
return !_contentControlsNotAllowedToAdd.Any(type => type.IsAssignableFrom(control.GetType())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected override void OnInitialized() |
|
|
|
|
{ |
|
|
|
|
base.OnInitialized(); |
|
|
|
@ -158,12 +140,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
@@ -158,12 +140,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
|
|
|
|
|
if (ExtendedItem.ContentProperty.IsCollection) |
|
|
|
|
return CollectionSupport.CanCollectionAdd(ExtendedItem.ContentProperty.ReturnType, |
|
|
|
|
operation.PlacedItems.Select(p => p.Item.Component)); |
|
|
|
|
if (ExtendedItem.View is ContentControl) { |
|
|
|
|
if (!CanContentControlAdd((ContentControl) ExtendedItem.View)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ExtendedItem.ContentProperty.ReturnType == typeof(string)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|