diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs
index 27942f1e80..283596a2c5 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs
@@ -27,6 +27,7 @@ using ICSharpCode.WpfDesign.Extensions;
using ICSharpCode.WpfDesign.Designer.Converters;
using System.Globalization;
using System.Windows.Data;
+using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs
index 3958c4e123..5b053c6366 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs
@@ -28,6 +28,7 @@ using System.Windows.Media;
using ICSharpCode.WpfDesign.Designer.Converters;
using System.Globalization;
using System.Windows.Data;
+using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/QuickOperationMenu.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/QuickOperationMenu.cs
index 5e8bf3d274..2e24bf0a42 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/QuickOperationMenu.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/QuickOperationMenu.cs
@@ -25,6 +25,7 @@ using System.Windows.Media;
using ICSharpCode.WpfDesign.Designer.Converters;
using System.Globalization;
using System.Windows.Data;
+using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.Controls
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenu.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenu.xaml
new file mode 100644
index 0000000000..961888a0b2
--- /dev/null
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenu.xaml
@@ -0,0 +1,11 @@
+
+
+
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenu.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenu.xaml.cs
new file mode 100644
index 0000000000..f23051132e
--- /dev/null
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenu.xaml.cs
@@ -0,0 +1,68 @@
+// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Markup;
+using System.Xml;
+using ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FormatedTextEditor;
+using ICSharpCode.WpfDesign.Designer.Xaml;
+using ICSharpCode.WpfDesign.XamlDom;
+
+namespace ICSharpCode.WpfDesign.Designer.Extensions
+{
+ public partial class EditStyleContextMenu
+ {
+ private DesignItem designItem;
+
+ public EditStyleContextMenu(DesignItem designItem)
+ {
+ this.designItem = designItem;
+
+ InitializeComponent();
+ }
+
+ void Click_EditStyle(object sender, RoutedEventArgs e)
+ {
+ var element = designItem.View;
+ object defaultStyleKey = element.GetValue(FrameworkElement.DefaultStyleKeyProperty);
+ Style style = Application.Current.TryFindResource(defaultStyleKey) as Style;
+
+ var service = ((XamlComponentService) designItem.Services.Component);
+
+ var ms = new MemoryStream();
+ XmlTextWriter writer = new XmlTextWriter(ms, System.Text.Encoding.UTF8);
+ writer.Formatting = Formatting.Indented;
+ XamlWriter.Save(style, writer);
+
+ var rootItem = this.designItem.Context.RootItem as XamlDesignItem;
+
+ ms.Position = 0;
+ var sr = new StreamReader(ms);
+ var xaml = sr.ReadToEnd();
+
+ var xamlObject = XamlParser.ParseSnippet(rootItem.XamlObject, xaml, ((XamlDesignContext)this.designItem.Context).ParserSettings);
+
+ var styleDesignItem=service.RegisterXamlComponentRecursive(xamlObject);
+ designItem.Properties.GetProperty("Resources").CollectionElements.Add(styleDesignItem);
+ }
+ }
+}
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenuExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenuExtension.cs
new file mode 100644
index 0000000000..685936eccb
--- /dev/null
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/EditStyleContextMenuExtension.cs
@@ -0,0 +1,53 @@
+// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of this
+// software and associated documentation files (the "Software"), to deal in the Software
+// without restriction, including without limitation the rights to use, copy, modify, merge,
+// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
+// to whom the Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all copies or
+// substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
+// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Linq;
+using System.Windows.Controls;
+using ICSharpCode.WpfDesign.Adorners;
+using ICSharpCode.WpfDesign.Extensions;
+
+namespace ICSharpCode.WpfDesign.Designer.Extensions
+{
+ [ExtensionServer(typeof (OnlyOneItemSelectedExtensionServer))]
+ [ExtensionFor(typeof (Control))]
+ [Extension(Order = 10)]
+ public class EditStyleContextMenuExtension : PrimarySelectionAdornerProvider
+ {
+ DesignPanel panel;
+ ContextMenu contextMenu;
+
+ protected override void OnInitialized()
+ {
+ base.OnInitialized();
+
+ contextMenu = new EditStyleContextMenu(ExtendedItem);
+ panel = ExtendedItem.Context.Services.DesignPanel as DesignPanel;
+ if (panel != null)
+ panel.AddContextMenu(contextMenu);
+ }
+
+ protected override void OnRemove()
+ {
+ if (panel != null)
+ panel.RemoveContextMenu(contextMenu);
+
+ base.OnRemove();
+ }
+ }
+}
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SkewThumbExtension.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SkewThumbExtension.cs
index 65066ce356..47c48c1434 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SkewThumbExtension.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SkewThumbExtension.cs
@@ -27,6 +27,7 @@ using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Controls;
using ICSharpCode.WpfDesign.Extensions;
using System.Collections.Generic;
+using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
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 a4ac2e5fb2..b8cb90fd95 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs
@@ -19,16 +19,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using System.Windows;
-using ICSharpCode.WpfDesign.Extensions;
-using System.ComponentModel;
using ICSharpCode.WpfDesign.Adorners;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
-using System.Windows.Automation.Peers;
-using System.Windows.Controls.Primitives;
using System.Diagnostics;
using System.Windows.Input;
@@ -36,6 +31,20 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
{
public class SnaplinePlacementBehavior : RasterPlacementBehavior
{
+ public static bool GetDisableSnaplines(DependencyObject obj)
+ {
+ return (bool)obj.GetValue(DisableSnaplinesProperty);
+ }
+
+ public static void SetDisableSnaplines(DependencyObject obj, bool value)
+ {
+ obj.SetValue(DisableSnaplinesProperty, value);
+ }
+
+ public static readonly DependencyProperty DisableSnaplinesProperty =
+ DependencyProperty.RegisterAttached("DisableSnaplines", typeof(bool), typeof(SnaplinePlacementBehavior), new PropertyMetadata(false));
+
+
AdornerPanel adornerPanel;
Canvas surface;
List horizontalMap;
@@ -194,18 +203,18 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
if (designItem != null && designItem.ContentProperty != null && designItem.ContentProperty.IsCollection)
foreach (var collectionElement in designItem.ContentProperty.CollectionElements)
+ {
+ if (collectionElement != null)
+ yield return collectionElement;
+
+ foreach (var el in AllDesignItems(collectionElement))
{
- if (collectionElement != null)
- yield return collectionElement;
-
- foreach (var el in AllDesignItems(collectionElement))
- {
- if (el != null)
- yield return el;
- }
+ if (el != null)
+ yield return el;
}
+ }
}
-
+
void BuildMaps(PlacementOperation operation)
{
horizontalMap = new List();
@@ -217,10 +226,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
AddLines(containerRect, 0, false);
foreach (var item in AllDesignItems() /* ExtendedItem.ContentProperty.CollectionElements */
- .Except(operation.PlacedItems.Select(f => f.Item))) {
+ .Except(operation.PlacedItems.Select(f => f.Item))
+ .Where(x=>!GetDisableSnaplines(x.View))) {
if (item != null) {
var bounds = GetPosition(operation, item);
-
+
AddLines(bounds, 0, false);
AddLines(bounds, Margin, true);
AddBaseline(item, bounds, horizontalMap);
@@ -235,26 +245,26 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
void AddLines(Rect r, double inflate, bool requireOverlap, List h, List v, PlacementAlignment? filter)
{
- if (r != Rect.Empty)
- {
- Rect r2 = r;
- r2.Inflate(inflate, inflate);
-
- if (filter == null || filter.Value.Vertical == VerticalAlignment.Top)
- h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Top - 1, Start = r.Left, End = r.Right });
- if (filter == null || filter.Value.Vertical == VerticalAlignment.Bottom)
- h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Bottom - 1, Start = r.Left, End = r.Right });
- if (filter == null || filter.Value.Horizontal == HorizontalAlignment.Left)
- v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Left - 1, Start = r.Top, End = r.Bottom });
- if (filter == null || filter.Value.Horizontal == HorizontalAlignment.Right)
- v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Right - 1, Start = r.Top, End = r.Bottom });
-
- if (filter == null)
- {
- h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Top + Math.Abs((r2.Top - r2.Bottom) / 2), Start = r.Left, End = r.Right });
- v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Left + Math.Abs((r2.Left - r2.Right) / 2), Start = r.Top, End = r.Bottom });
- }
- }
+ if (r != Rect.Empty)
+ {
+ Rect r2 = r;
+ r2.Inflate(inflate, inflate);
+
+ if (filter == null || filter.Value.Vertical == VerticalAlignment.Top)
+ h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Top - 1, Start = r.Left, End = r.Right });
+ if (filter == null || filter.Value.Vertical == VerticalAlignment.Bottom)
+ h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Bottom - 1, Start = r.Left, End = r.Right });
+ if (filter == null || filter.Value.Horizontal == HorizontalAlignment.Left)
+ v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Left - 1, Start = r.Top, End = r.Bottom });
+ if (filter == null || filter.Value.Horizontal == HorizontalAlignment.Right)
+ v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Right - 1, Start = r.Top, End = r.Bottom });
+
+ if (filter == null)
+ {
+ h.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Top + Math.Abs((r2.Top - r2.Bottom) / 2), Start = r.Left, End = r.Right });
+ v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Left + Math.Abs((r2.Left - r2.Right) / 2), Start = r.Top, End = r.Bottom });
+ }
+ }
}
void AddBaseline(DesignItem item, Rect bounds, List list)
@@ -279,9 +289,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
void DrawLine(double x1, double y1, double x2, double y2)
{
- if (double.IsInfinity(x1) || double.IsNaN(x1) || double.IsInfinity(y1) || double.IsNaN(y1) ||
- double.IsInfinity(x2) || double.IsNaN(x2) || double.IsInfinity(y2) || double.IsNaN(y2))
- return;
+ if (double.IsInfinity(x1) || double.IsNaN(x1) || double.IsInfinity(y1) || double.IsNaN(y1) ||
+ double.IsInfinity(x2) || double.IsNaN(x2) || double.IsInfinity(y2) || double.IsNaN(y2))
+ return;
var line1 = new Line() {
X1 = x1,
@@ -321,7 +331,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
}
static bool Snap(List input, List map, double accuracy,
- out List drawLines, out double delta)
+ out List drawLines, out double delta)
{
delta = double.MaxValue;
drawLines = null;
@@ -330,7 +340,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
foreach (var mapLine in map) {
if (Math.Abs(mapLine.Offset - inputLine.Offset) <= accuracy) {
if (!inputLine.RequireOverlap && !mapLine.RequireOverlap ||
- Math.Max(inputLine.Start, mapLine.Start) < Math.Min(inputLine.End, mapLine.End))
+ Math.Max(inputLine.Start, mapLine.Start) < Math.Min(inputLine.End, mapLine.End))
{
if (mapLine.Group == inputLine.Group)
delta = mapLine.Offset - inputLine.Offset;
@@ -376,4 +386,3 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
}
}
}
-
\ No newline at end of file
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TextBlockRightClickContextMenu.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TextBlockRightClickContextMenu.xaml.cs
index b581d15fe6..262fd14e57 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TextBlockRightClickContextMenu.xaml.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TextBlockRightClickContextMenu.xaml.cs
@@ -20,6 +20,7 @@ using System;
using System.Linq;
using System.Windows;
using ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FormatedTextEditor;
+using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs
index d37f0845df..b7099f6144 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs
@@ -119,7 +119,7 @@ namespace ICSharpCode.WpfDesign.Designer
}
}
- internal static void CreateVisualTree(this UIElement element)
+ public static void CreateVisualTree(this UIElement element)
{
try
{
@@ -227,13 +227,13 @@ namespace ICSharpCode.WpfDesign.Designer
{
var itemPos = new ItemPos() {DesignItem = designItem};
- var pos = operation.CurrentContainerBehavior.GetPosition(operation, designItem);
+ var pos = operation.CurrentContainerBehavior.GetPosition(operation, designItem);
itemPos.Xmin = pos.X;
itemPos.Xmax = pos.X + pos.Width;
itemPos.Ymin = pos.Y;
itemPos.Ymax = pos.Y + pos.Height;
- return itemPos;
+ return itemPos;
}
public static void WrapItemsNewContainer(IEnumerable items, Type containerType)
@@ -252,7 +252,7 @@ namespace ICSharpCode.WpfDesign.Designer
if (placement == null)
return;
- var operation = PlacementOperation.Start(items.ToList(), PlacementType.Move);
+ var operation = PlacementOperation.Start(items.ToList(), PlacementType.Move);
var newInstance = Activator.CreateInstance(containerType);
DesignItem newPanel = _context.Services.Component.RegisterComponentForDesigner(newInstance);
@@ -261,7 +261,7 @@ namespace ICSharpCode.WpfDesign.Designer
List itemList = new List();
foreach (var item in collection) {
- itemList.Add(GetItemPos(operation, item));
+ itemList.Add(GetItemPos(operation, item));
//var pos = placement.GetPosition(null, item);
if (container.Component is Canvas) {
item.Properties.GetAttachedProperty(Canvas.RightProperty).Reset();
@@ -297,7 +297,7 @@ namespace ICSharpCode.WpfDesign.Designer
item.DesignItem.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(item.Ymin - ymin);
}
- newPanel.ContentProperty.CollectionElements.Add(item.DesignItem);
+ newPanel.ContentProperty.CollectionElements.Add(item.DesignItem);
} else if (newPanel.Component is Grid) {
Thickness thickness = new Thickness(0);
@@ -319,21 +319,21 @@ namespace ICSharpCode.WpfDesign.Designer
item.DesignItem.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(thickness);
- newPanel.ContentProperty.CollectionElements.Add(item.DesignItem);
+ newPanel.ContentProperty.CollectionElements.Add(item.DesignItem);
} else if (newPanel.Component is Viewbox) {
- newPanel.ContentProperty.SetValue(item.DesignItem);
+ newPanel.ContentProperty.SetValue(item.DesignItem);
}
}
- PlacementOperation operation2 = PlacementOperation.TryStartInsertNewComponents(
+ PlacementOperation operation2 = PlacementOperation.TryStartInsertNewComponents(
container,
new[] { newPanel },
new[] { new Rect(xmin, ymin, xmax - xmin, ymax - ymin).Round() },
PlacementType.AddItem
);
- operation2.Commit();
+ operation2.Commit();
operation.Commit();
@@ -355,8 +355,8 @@ namespace ICSharpCode.WpfDesign.Designer
if (placement == null)
return;
- var operation = PlacementOperation.Start(items.ToList(), PlacementType.Move);
-
+ var operation = PlacementOperation.Start(items.ToList(), PlacementType.Move);
+
//var changeGroup = container.OpenGroup("Arrange Elements");
List itemList = new List();
@@ -392,19 +392,19 @@ namespace ICSharpCode.WpfDesign.Designer
}
else if (container.Component is Grid)
{
- if ((HorizontalAlignment)item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).ValueOnInstance != HorizontalAlignment.Right)
- {
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Left = xmin;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
- else
- {
- var pos = (double)((Panel)item.Parent.Component).ActualWidth - (xmin + (double)((FrameworkElement)item.Component).ActualWidth);
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Right = pos;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
+ if ((HorizontalAlignment)item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).ValueOnInstance != HorizontalAlignment.Right)
+ {
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Left = xmin;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
+ else
+ {
+ var pos = (double)((Panel)item.Parent.Component).ActualWidth - (xmin + (double)((FrameworkElement)item.Component).ActualWidth);
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Right = pos;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
}
}
break;
@@ -414,34 +414,34 @@ namespace ICSharpCode.WpfDesign.Designer
{
if (!item.Properties.GetAttachedProperty(Canvas.RightProperty).IsSet)
{
- if (!item.Properties.GetAttachedProperty(Canvas.RightProperty).IsSet)
- {
- item.Properties.GetAttachedProperty(Canvas.LeftProperty).SetValue(mpos - (((FrameworkElement)item.Component).ActualWidth) / 2);
- }
- else
- {
- var pp = mpos - (((FrameworkElement)item.Component).ActualWidth) / 2;
- var pos = (double)((Panel)item.Parent.Component).ActualWidth - pp - (((FrameworkElement)item.Component).ActualWidth);
- item.Properties.GetAttachedProperty(Canvas.RightProperty).SetValue(pos);
- }
- }
+ if (!item.Properties.GetAttachedProperty(Canvas.RightProperty).IsSet)
+ {
+ item.Properties.GetAttachedProperty(Canvas.LeftProperty).SetValue(mpos - (((FrameworkElement)item.Component).ActualWidth) / 2);
+ }
+ else
+ {
+ var pp = mpos - (((FrameworkElement)item.Component).ActualWidth) / 2;
+ var pos = (double)((Panel)item.Parent.Component).ActualWidth - pp - (((FrameworkElement)item.Component).ActualWidth);
+ item.Properties.GetAttachedProperty(Canvas.RightProperty).SetValue(pos);
+ }
+ }
}
else if (container.Component is Grid)
{
- if ((HorizontalAlignment)item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).ValueOnInstance != HorizontalAlignment.Right)
- {
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Left = mpos - (((FrameworkElement)item.Component).ActualWidth) / 2;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
- else
- {
- var pp = mpos - (((FrameworkElement)item.Component).ActualWidth) / 2;
- var pos = (double)((Panel)item.Parent.Component).ActualWidth - pp - (((FrameworkElement)item.Component).ActualWidth);
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Right = pos;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
+ if ((HorizontalAlignment)item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).ValueOnInstance != HorizontalAlignment.Right)
+ {
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Left = mpos - (((FrameworkElement)item.Component).ActualWidth) / 2;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
+ else
+ {
+ var pp = mpos - (((FrameworkElement)item.Component).ActualWidth) / 2;
+ var pos = (double)((Panel)item.Parent.Component).ActualWidth - pp - (((FrameworkElement)item.Component).ActualWidth);
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Right = pos;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
}
}
break;
@@ -462,20 +462,20 @@ namespace ICSharpCode.WpfDesign.Designer
}
else if (container.Component is Grid)
{
- if ((HorizontalAlignment)item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).ValueOnInstance != HorizontalAlignment.Right)
- {
- var pos = xmax - (double)((FrameworkElement)item.Component).ActualWidth;
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Left = pos;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
- else
- {
- var pos = (double)((Panel)item.Parent.Component).ActualWidth - xmax;
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Right = pos;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
+ if ((HorizontalAlignment)item.Properties.GetProperty(FrameworkElement.HorizontalAlignmentProperty).ValueOnInstance != HorizontalAlignment.Right)
+ {
+ var pos = xmax - (double)((FrameworkElement)item.Component).ActualWidth;
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Left = pos;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
+ else
+ {
+ var pos = (double)((Panel)item.Parent.Component).ActualWidth - xmax;
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Right = pos;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
}
}
break;
@@ -495,20 +495,20 @@ namespace ICSharpCode.WpfDesign.Designer
}
else if (container.Component is Grid)
{
- if ((VerticalAlignment)item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).ValueOnInstance != VerticalAlignment.Bottom)
- {
- item.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(ymin);
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Top = ymin;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
- else
- {
- var pos = (double)((Panel)item.Parent.Component).ActualHeight - (ymin + (double)((FrameworkElement)item.Component).ActualHeight);
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Bottom = pos;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
+ if ((VerticalAlignment)item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).ValueOnInstance != VerticalAlignment.Bottom)
+ {
+ item.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(ymin);
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Top = ymin;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
+ else
+ {
+ var pos = (double)((Panel)item.Parent.Component).ActualHeight - (ymin + (double)((FrameworkElement)item.Component).ActualHeight);
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Bottom = pos;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
}
}
break;
@@ -529,20 +529,20 @@ namespace ICSharpCode.WpfDesign.Designer
}
else if (container.Component is Grid)
{
- if ((VerticalAlignment)item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).ValueOnInstance != VerticalAlignment.Bottom)
- {
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Top = ympos - (((FrameworkElement)item.Component).ActualHeight) / 2;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
- else
- {
- var pp = mpos - (((FrameworkElement)item.Component).ActualHeight) / 2;
- var pos = (double)((Panel)item.Parent.Component).ActualHeight - pp - (((FrameworkElement)item.Component).ActualHeight);
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Bottom = pos;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
+ if ((VerticalAlignment)item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).ValueOnInstance != VerticalAlignment.Bottom)
+ {
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Top = ympos - (((FrameworkElement)item.Component).ActualHeight) / 2;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
+ else
+ {
+ var pp = mpos - (((FrameworkElement)item.Component).ActualHeight) / 2;
+ var pos = (double)((Panel)item.Parent.Component).ActualHeight - pp - (((FrameworkElement)item.Component).ActualHeight);
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Bottom = pos;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
}
}
break;
@@ -563,27 +563,27 @@ namespace ICSharpCode.WpfDesign.Designer
}
else if (container.Component is Grid)
{
- if ((VerticalAlignment)item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).ValueOnInstance != VerticalAlignment.Bottom)
- {
- var pos = ymax - (double)((FrameworkElement)item.Component).ActualHeight;
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Top = pos;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
- else
- {
- var pos = (double)((Panel)item.Parent.Component).ActualHeight - ymax;
- var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
- margin.Bottom = pos;
- item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
- }
+ if ((VerticalAlignment)item.Properties.GetProperty(FrameworkElement.VerticalAlignmentProperty).ValueOnInstance != VerticalAlignment.Bottom)
+ {
+ var pos = ymax - (double)((FrameworkElement)item.Component).ActualHeight;
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Top = pos;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
+ else
+ {
+ var pos = (double)((Panel)item.Parent.Component).ActualHeight - ymax;
+ var margin = (Thickness)item.Properties.GetProperty(FrameworkElement.MarginProperty).ValueOnInstance;
+ margin.Bottom = pos;
+ item.Properties.GetProperty(FrameworkElement.MarginProperty).SetValue(margin);
+ }
}
}
break;
}
}
- operation.Commit();
+ operation.Commit();
}
}
}
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineTreeView.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineTreeView.cs
index 30d9a974b5..b15cb23b81 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineTreeView.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineTreeView.cs
@@ -20,6 +20,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.OutlineView
{
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FormatedTextEditor/FormatedTextEditor.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FormatedTextEditor/FormatedTextEditor.xaml.cs
index 720bd79d8d..6cff46e6a1 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FormatedTextEditor/FormatedTextEditor.xaml.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FormatedTextEditor/FormatedTextEditor.xaml.cs
@@ -23,6 +23,7 @@ using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
using ICSharpCode.WpfDesign.Designer.Xaml;
+using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FormatedTextEditor
{
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ThumbnailView/ThumbnailView.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ThumbnailView/ThumbnailView.cs
index 2913fa6bdc..606ae58684 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ThumbnailView/ThumbnailView.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ThumbnailView/ThumbnailView.cs
@@ -27,6 +27,7 @@ using System.Windows.Controls.Primitives;
using System.Windows.Media;
using System.Diagnostics;
using ICSharpCode.WpfDesign.Designer.Controls;
+using ICSharpCode.WpfDesign.Designer.UIExtensions;
namespace ICSharpCode.WpfDesign.Designer.ThumbnailView
{
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Translations.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Translations.cs
index 6117d3181c..df5334eceb 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Translations.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Translations.cs
@@ -77,14 +77,14 @@ namespace ICSharpCode.WpfDesign.Designer
return "Wrap in Grid";
}
}
-
+
public virtual string WrapInBorder {
get {
return "Wrap in Border";
}
}
- public virtual string WrapInViewbox {
+ public virtual string WrapInViewbox {
get {
return "Wrap in Viewbox";
}
@@ -145,5 +145,13 @@ namespace ICSharpCode.WpfDesign.Designer
return "Arrange Bottom";
}
}
+
+ public virtual string EditStyle
+ {
+ get
+ {
+ return "Edit Style";
+ }
+ }
}
}
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/UIHelpers.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/UIExtensions/UIHelpers.cs
similarity index 94%
rename from src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/UIHelpers.cs
rename to src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/UIExtensions/UIHelpers.cs
index 53c6d19d3d..23f8b8f152 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/UIHelpers.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/UIExtensions/UIHelpers.cs
@@ -23,9 +23,9 @@ using System.Text;
using System.Windows;
using System.Windows.Media;
-namespace ICSharpCode.WpfDesign.Designer
+namespace ICSharpCode.WpfDesign.Designer.UIExtensions
{
- static class UIHelpers
+ public static class UIHelpers
{
public static DependencyObject GetParentObject(this DependencyObject child)
{
@@ -85,7 +85,7 @@ namespace ICSharpCode.WpfDesign.Designer
return null;
}
- public static T TryFindChild(DependencyObject parent, string childName) where T : DependencyObject
+ public static T TryFindChild(this DependencyObject parent, string childName) where T : DependencyObject
{
if (parent == null) return null;
T foundChild = null;
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj
index 40aadb1395..f3b0cc3433 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj
@@ -87,6 +87,9 @@
+
+ EditStyleContextMenu.xaml
+
TextBlockRightClickContextMenu.xaml
@@ -96,6 +99,7 @@
+
@@ -273,7 +277,7 @@
-
+
@@ -285,6 +289,9 @@
+
+ Designer
+
Designer
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs
index 81fa1cddd3..5fbc9df801 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs
@@ -105,7 +105,7 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml
}
if (_context.RootItem != null && !string.IsNullOrEmpty(site.Name)) {
- var nameScope = NameScopeHelper.GetNameScopeFromObject(_context.RootItem.Component);
+ var nameScope = NameScopeHelper.GetNameScopeFromObject(((XamlDesignItem)_context.RootItem).XamlObject);
if (nameScope != null) {
// The object will be a part of the RootItem namescope, remove local namescope if set
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelCollectionElementsCollection.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelCollectionElementsCollection.cs
index e70e3c1a20..d3b1b163cf 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelCollectionElementsCollection.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlModelCollectionElementsCollection.cs
@@ -20,6 +20,7 @@ using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Windows;
using ICSharpCode.WpfDesign.XamlDom;
using ICSharpCode.WpfDesign.Designer.Services;
using System.Collections.Specialized;
@@ -174,6 +175,8 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml
void RemoveInternal(int index, XamlDesignItem item)
{
+ NameScopeHelper.NameChanged(item.XamlObject, item.Name, null);
+
Debug.Assert(property.CollectionElements[index] == item.XamlObject);
property.CollectionElements.RemoveAt(index);
@@ -187,6 +190,8 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml
if (CollectionChanged != null)
CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
+
+ NameScopeHelper.NameChanged(item.XamlObject, null, item.Name);
}
sealed class InsertAction : ITransactionItem
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/EditOperationTests.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/EditOperationTests.cs
index d95b53b0aa..827ccd037c 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/EditOperationTests.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/EditOperationTests.cs
@@ -291,7 +291,7 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
" \n" +
"\n" +
"\n" +
- "\n";
+ "\n";
AssertGridDesignerOutput(expectedXaml, grid.Context,
"xmlns:Controls0=\"clr-namespace:ICSharpCode.WpfDesign.Tests.Designer;assembly=ICSharpCode.WpfDesign.Tests\"",
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs
index 1419521e82..9356d98579 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/ModelTests.cs
@@ -553,7 +553,7 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
textBox.Properties[TextBox.TextProperty].Value.Properties["Path"].SetValue("SomeProperty");
string expectedXaml = "\n" +
- "\n";
+ "\n";
AssertCanvasDesignerOutput(expectedXaml, button.Context);
AssertLog("");
@@ -583,7 +583,7 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
" \n" +
"\n" +
"\n" +
- "";
+ "";
AssertCanvasDesignerOutput(expectedXaml, button.Context);
AssertLog("");
@@ -620,7 +620,7 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
" \n" +
" \n" +
" \n" +
- " \n" +
+ " \n" +
"";
AssertCanvasDesignerOutput(expectedXaml, button.Context);
@@ -689,7 +689,7 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
string expectedXaml = "\n" +
" \n" +
"\n" +
- "";
+ "";
AssertCanvasDesignerOutput(expectedXaml, checkBox.Context);
AssertLog("");
@@ -722,7 +722,7 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
string expectedXaml = "\n" +
" <" + typePrefix + typeName + " x:Key=\"res1\">" + expectedXamlValue + "" + typePrefix + typeName + ">\n" +
"\n" +
- "";
+ "";
AssertCanvasDesignerOutput(expectedXaml, textBlock.Context, additionalXmlns);
AssertLog("");
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/SetPropertyTests.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/SetPropertyTests.cs
index a290813f16..b031e01e57 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/SetPropertyTests.cs
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/Designer/SetPropertyTests.cs
@@ -44,7 +44,7 @@ namespace ICSharpCode.WpfDesign.Tests.Designer
button.Properties.GetProperty("Content").SetValue(new StaticResourceExtension());
button.Properties.GetProperty("Content").Value.Properties["ResourceKey"].SetValue("MyBrush");
// TODO : maybe we should support positional arguments from ctors as well => {StaticResource MyBrush}?
- AssertCanvasDesignerOutput("", button.Context);
+ AssertCanvasDesignerOutput("", button.Context);
}
[Test]
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/WpfDesign.Tests.csproj b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/WpfDesign.Tests.csproj
index 780ad08b4f..a18897b374 100644
--- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/WpfDesign.Tests.csproj
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/WpfDesign.Tests.csproj
@@ -75,8 +75,13 @@
+
+
+
+ NamscopeTestUsercontrol.xaml
+
@@ -106,5 +111,9 @@
Designer
+
+ Designer
+ MSBuild:Compile
+
\ No newline at end of file
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/ExampleControl.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/ExampleControl.cs
new file mode 100644
index 0000000000..7a1822a432
--- /dev/null
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/ExampleControl.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace ICSharpCode.WpfDesign.Tests.XamlDom
+{
+ public class ExampleControl : Control
+ {
+ public object Property1
+ {
+ get { return (object)GetValue(Property1Property); }
+ set { SetValue(Property1Property, value); }
+ }
+
+ public static readonly DependencyProperty Property1Property =
+ DependencyProperty.Register("Property1", typeof(object), typeof(ExampleControl), new PropertyMetadata(null));
+
+ }
+}
diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/NamescopeTest.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/NamescopeTest.cs
new file mode 100644
index 0000000000..09d1357a93
--- /dev/null
+++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/NamescopeTest.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Markup;
+using System.Xml;
+using ICSharpCode.WpfDesign.XamlDom;
+using NUnit.Framework;
+using ICSharpCode.WpfDesign.Designer;
+using ICSharpCode.WpfDesign.Designer.UIExtensions;
+
+namespace ICSharpCode.WpfDesign.Tests.XamlDom
+{
+ [TestFixture]
+ public class NamescopeTest : TestHelper
+ {
+ ///
+ /// NamescopeTest 1
+ ///
+ [Test]
+ public void NamescopeTest1()
+ {
+ var xaml= @"
+
+
+
+
+
+
+";
+
+ var obj = XamlParser.Parse(new StringReader(xaml));
+
+ ((FrameworkElement)obj.RootInstance).CreateVisualTree();
+
+ var example = ((FrameworkElement) obj.RootInstance).TryFindChild();
+ var buttonAa = ((FrameworkElement)obj.RootInstance).TryFindChild