diff --git a/samples/XamlDesigner/App.xaml.cs b/samples/XamlDesigner/App.xaml.cs index 6a9be5c98c..5d9484dadf 100644 --- a/samples/XamlDesigner/App.xaml.cs +++ b/samples/XamlDesigner/App.xaml.cs @@ -31,9 +31,16 @@ namespace ICSharpCode.XamlDesigner private static bool internalLoad = false; private static string lastRequesting = null; - + Assembly AppDomain_CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { + var assList = AppDomain.CurrentDomain.GetAssemblies(); + var loaded = assList.FirstOrDefault(x => x.FullName == args.Name); + if (loaded != null) + { + return loaded; + } + if (internalLoad) return null; @@ -48,7 +55,7 @@ namespace ICSharpCode.XamlDesigner ass = Assembly.Load(args.Name); } catch (Exception) { } - + if (ass == null && args.RequestingAssembly != null) { lastRequesting = args.RequestingAssembly.Location; var dir = Path.GetDirectoryName(args.RequestingAssembly.Location); @@ -68,7 +75,7 @@ namespace ICSharpCode.XamlDesigner } internalLoad = false; - + return ass; } diff --git a/samples/XamlDesigner/DocumentView.xaml b/samples/XamlDesigner/DocumentView.xaml index 06f45a450f..760bb699b9 100644 --- a/samples/XamlDesigner/DocumentView.xaml +++ b/samples/XamlDesigner/DocumentView.xaml @@ -13,10 +13,10 @@ + Visibility="{Binding InDesignMode, Converter={StaticResource CollapsedWhenFalse}}"/> \ No newline at end of file diff --git a/samples/XamlDesigner/DocumentView.xaml.cs b/samples/XamlDesigner/DocumentView.xaml.cs index fad8fa09f4..755ba648d1 100644 --- a/samples/XamlDesigner/DocumentView.xaml.cs +++ b/samples/XamlDesigner/DocumentView.xaml.cs @@ -25,7 +25,7 @@ namespace ICSharpCode.XamlDesigner InitializeComponent(); Document = doc; - Shell.Instance.Views[doc] = this; + Shell.Instance.Views[doc] = this; //uxTextEditor.DataBindings.Add("Text", doc, "Text", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged); Document.Mode = DocumentMode.Design; @@ -52,7 +52,15 @@ namespace ICSharpCode.XamlDesigner try { uxTextEditor.ScrollTo(error.Line, error.Column); uxTextEditor.CaretOffset = uxTextEditor.Document.GetOffset(error.Line, error.Column); - } catch (ArgumentException) { + + int n = 0; + char chr; + while ((chr = uxTextEditor.Document.GetCharAt(uxTextEditor.CaretOffset + n)) != ' ' && chr != '.' && chr != '<' && chr != '>' && chr != '"') + { n++; } + + uxTextEditor.SelectionLength = n; + } + catch (ArgumentException) { // invalid line number } } diff --git a/samples/XamlDesigner/ErrorListView.xaml b/samples/XamlDesigner/ErrorListView.xaml index fa661fa0e3..158a26f25e 100644 --- a/samples/XamlDesigner/ErrorListView.xaml +++ b/samples/XamlDesigner/ErrorListView.xaml @@ -2,15 +2,22 @@ xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Services="clr-namespace:ICSharpCode.WpfDesign.Designer.Services;assembly=ICSharpCode.WpfDesign.Designer"> - - - - - - - - + + + + + + + + + + + + diff --git a/samples/XamlDesigner/Toolbox.cs b/samples/XamlDesigner/Toolbox.cs index d4880827a7..b4b400e8c6 100644 --- a/samples/XamlDesigner/Toolbox.cs +++ b/samples/XamlDesigner/Toolbox.cs @@ -78,7 +78,7 @@ namespace ICSharpCode.XamlDesigner static bool IsControl(Type t) { - return !t.IsAbstract && !t.IsGenericTypeDefinition && t.IsSubclassOf(typeof(FrameworkElement)); + return !t.IsAbstract && !t.IsGenericTypeDefinition && t.IsSubclassOf(typeof(UIElement)) && t.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null) != null; } } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs index b4e0a025a1..d3f6b61379 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/AdornerLayer.cs @@ -227,8 +227,12 @@ namespace ICSharpCode.WpfDesign.Designer.Controls var rt = (MatrixTransform) adorner.AdornedElement.TransformToAncestor(_designPanel); if (adorner.AdornedDesignItem != null && adorner.AdornedDesignItem.Parent != null && adorner.AdornedDesignItem.Parent.View is Canvas && adorner.AdornedElement.RenderSize.Height == 0 && adorner.AdornedElement.RenderSize.Width == 0) { - var xOffset = rt.Matrix.OffsetX - (((FrameworkElement)adorner.AdornedElement).Width / 2); - var yOffset = rt.Matrix.OffsetY - (((FrameworkElement)adorner.AdornedElement).Height / 2); + var width = ((FrameworkElement) adorner.AdornedElement).Width; + width = width > 0 ? width : 2.0; + var height = ((FrameworkElement)adorner.AdornedElement).Height; + height = height > 0 ? height : 2.0; + var xOffset = rt.Matrix.OffsetX - (width / 2); + var yOffset = rt.Matrix.OffsetY - (height / 2); rt = new MatrixTransform(new Matrix(rt.Matrix.M11, rt.Matrix.M12, rt.Matrix.M21, rt.Matrix.M22, xOffset, yOffset)); } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml index 7183b558c4..c1c8fb22c1 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml @@ -117,17 +117,14 @@ - + - - - + + +