Browse Source

Merge branch 'DrawLineOnCanvas' of https://github.com/jogibear9988/SharpDevelop into DrawLineOnCanvas

Conflicts:
	src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml
pull/633/head
jogibear9988 11 years ago
parent
commit
75477250aa
  1. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml
  2. 1
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs
  3. 13
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml

@ -100,7 +100,7 @@ @@ -100,7 +100,7 @@
</Grid.Resources>
<Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="7" Height="7" Name="thumbRectangle" SnapsToDevicePixels="True" Stroke="{TemplateBinding Foreground}" Fill="White" RadiusX="1.414" RadiusY="1.414" />
<Ellipse HorizontalAlignment="Left" VerticalAlignment="Top" Width="7" Height="7" Name="thumbElipse" Stroke="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Fill="White" Visibility="Collapsed" />
<Menu Height="15" HorizontalAlignment="Left" Margin="0,-19,-19,0" VerticalAlignment="Top" Width="15" BorderThickness="0" Background="Transparent" Visibility="{Binding Path=OperationMenu, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static Converters:CollapsedWhenNull.Instance}}" >
<Menu Foreground="Black" Height="15" HorizontalAlignment="Left" Margin="0,-19,-19,0" VerticalAlignment="Top" Width="15" BorderThickness="0" Background="Transparent" Visibility="{Binding Path=OperationMenu, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static Converters:CollapsedWhenNull.Instance}}" >
<MenuItem RenderTransform="{TemplateBinding InnerRenderTransform}" Height="15" Width="15" Padding="0" Background="Transparent" BorderThickness="1" ItemsSource="{TemplateBinding OperationMenu}">
<MenuItem.Header>
<Path Data="M3.5,5.5 L11.5,5.5 L7.5,11 z" Fill="Black" Stroke="Gray" StrokeThickness="1" />

1
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Xaml/XamlComponentService.cs

@ -89,6 +89,7 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml @@ -89,6 +89,7 @@ namespace ICSharpCode.WpfDesign.Designer.Xaml
}
XamlDesignItem item = new XamlDesignItem(_context.Document.CreateObject(component), _context);
if (!(component is string))
_sites.Add(component, item);
if (ComponentRegistered != null) {
ComponentRegistered(this, new DesignItemEventArgs(item));

13
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs

@ -21,6 +21,7 @@ using System.Diagnostics; @@ -21,6 +21,7 @@ using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Documents;
@ -105,13 +106,21 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -105,13 +106,21 @@ namespace ICSharpCode.WpfDesign.XamlDom
/// <summary>
/// Adds a value at the specified index in the collection.
/// </summary>
public static void Insert(Type collectionType, object collectionInstance, XamlPropertyValue newElement, int index)
public static bool Insert(Type collectionType, object collectionInstance, XamlPropertyValue newElement, int index)
{
var hasInsert = collectionType.GetMethods().Any(x => x.Name == "Insert");
if (hasInsert) {
collectionType.InvokeMember(
"Insert", BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Instance,
null, collectionInstance,
new object[] { index, newElement.GetValueFor(null) },
CultureInfo.InvariantCulture);
return true;
}
return false;
}
/// <summary>
@ -121,7 +130,7 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -121,7 +130,7 @@ namespace ICSharpCode.WpfDesign.XamlDom
internal static bool TryInsert(Type collectionType, object collectionInstance, XamlPropertyValue newElement, int index)
{
try {
Insert(collectionType, collectionInstance, newElement, index);
return Insert(collectionType, collectionInstance, newElement, index);
} catch (MissingMethodException) {
return false;
}

Loading…
Cancel
Save