Browse Source

Merge branch 'master' of github.com:icsharpcode/SharpDevelop into newNR

Conflicts:
	src/AddIns/Analysis/MachineSpecifications/MachineSpecifications.Tests/Properties/AssemblyInfo.cs
	src/AddIns/Analysis/MachineSpecifications/MachineSpecifications.Tests/Src/ClassFilterBuilder.cs
	src/AddIns/Analysis/MachineSpecifications/MachineSpecifications.Tests/Src/MSpecTestFrameworkTests.cs
	src/AddIns/Analysis/UnitTesting/Src/InnerClassEnumerator.cs
	src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs
	src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfToolbox.cs
	src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs
	src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.AddIn.csproj
	src/AddIns/Misc/PackageManagement/Project/PackageManagement.csproj
	src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
	src/Libraries/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs
	src/Main/Base/Project/Src/Gui/Dialogs/GotoDialog.cs
	src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/BuildAdvanced.xaml.cs
	src/Main/Base/Project/Src/Project/Behaviors/DotNetStartBehavior.cs
	src/Main/Base/Project/Src/Util/ExtensionMethods.cs
	src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj
	src/Main/GlobalAssemblyInfo.template
pull/59/merge
Siegfried Pammer 12 years ago
parent
commit
2dc8a6dc1a
  1. 9
      samples/XamlDesigner/Document.cs
  2. 7
      samples/XamlDesigner/MainWindow.xaml
  3. 49
      samples/XamlDesigner/MyTypeFinder.cs
  4. 103
      samples/XamlDesigner/Toolbox.cs
  5. 13
      samples/XamlDesigner/ToolboxView.xaml
  6. 17
      samples/XamlDesigner/ToolboxView.xaml.cs
  7. 1
      samples/XamlDesigner/XamlDesigner.csproj
  8. 12
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  9. 12
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanel.xaml.cs
  10. 10
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsTreeNodes.cs
  11. 12
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageOptionsPanel.xaml.cs
  12. 12
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProjectOptionsPanel.xaml.cs
  13. 5
      src/AddIns/Analysis/CodeQuality/Properties/AssemblyInfo.cs
  14. 11
      src/AddIns/Analysis/CodeQuality/Reporting/BaseReport.cs
  15. 11
      src/AddIns/Analysis/CodeQuality/Reporting/DependencyReport.cs
  16. 11
      src/AddIns/Analysis/CodeQuality/Reporting/OverviewReport.cs
  17. 11
      src/AddIns/Analysis/CodeQuality/Reporting/ReportViewModel.cs
  18. 4
      src/AddIns/Analysis/MachineSpecifications/MachineSpecifications.Tests/Properties/AssemblyInfo.cs
  19. 2
      src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestFramework.cs
  20. 12
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  21. 12
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs
  22. 11
      src/AddIns/Analysis/UnitTesting/Test/Project/DoubleNestedTestClassWithBaseType.cs
  23. 12
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs
  24. 12
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs
  25. 12
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml.cs
  26. 5
      src/AddIns/BackendBindings/JavaScriptBinding/Project/Src/ES3/ES3Lexer.Action.cs
  27. 5
      src/AddIns/BackendBindings/JavaScriptBinding/Project/Src/ES3/ES3Parser.Action.cs
  28. 7
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParsePropertyTests.cs
  29. 2
      src/AddIns/Debugger/Debugger.Core/Options.cs
  30. 5
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/WizardErrorUserControl.cs
  31. 5
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/EDMObjects/Designer/ChangeWatcher/EDMDesignerChangeWatcher.cs
  32. 5
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/EDMObjects/Designer/ChangeWatcher/IEDMDesignerChangeWatcherObserver.cs
  33. 5
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/IO/EntityModelCodeGenerator.cs
  34. 4
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/ObjectModelConverters/ObjectModelConverterException.cs
  35. 12
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GeneralOptionsPanel.xaml.cs
  36. 13
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GridOptionsPanel.xaml.cs
  37. 13
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/LocalizationModelOptionsPanel.xaml.cs
  38. 10
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/MyTypeFinder.cs
  39. 23
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopTranslations.cs
  40. 53
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ThumbnailViewPad.cs
  41. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfDisplayBinding.cs
  42. 50
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfToolbox.cs
  43. 20
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs
  44. 8
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.AddIn.csproj
  45. 19
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin
  46. 1
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Configuration/AssemblyInfo.cs
  47. 218
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/CanvasPositionHandle.cs
  48. 85
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ClearableTextBox.cs
  49. 26
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs
  50. 321
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ControlStyles.xaml
  51. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GrayOutDesignerExceptActiveArea.cs
  52. 101
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/InfoTextEnterArea.cs
  53. 7
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/MarginHandle.cs
  54. 28
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs
  55. 227
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/QuickOperationMenu.cs
  56. 28
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/RenderTransformOriginThumb.cs
  57. 38
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/RotateThumb.cs
  58. 12
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs
  59. 113
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Converters.cs
  60. 97
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs
  61. 75
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs
  62. 52
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml
  63. 64
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/BorderForInvisibleControl.cs
  64. 56
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs
  65. 77
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPositionExtension.cs
  66. 41
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultPlacementBehavior.cs
  67. 48
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/Initializers.cs
  68. 4
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/MarginHandleExtension.cs
  69. 26
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelInstanceFactory.cs
  70. 5
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelMove.cs
  71. 21
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/QuickOperationMenuExtension.cs
  72. 126
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/RasterPlacementBehavior.cs
  73. 104
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/RenderTransformOriginExtension.cs
  74. 163
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs
  75. 178
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/RotateThumbExtension.cs
  76. 12
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs
  77. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TopLeftContainerDragHandle.cs
  78. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.GridSnap.png
  79. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.GuideSnap.png
  80. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.Properties.Categorized.png
  81. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.Properties.Events.png
  82. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.Properties.Properties.png
  83. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.Properties.SortAlphabet.png
  84. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.WpfOutline.Eye.png
  85. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.WpfOutline.EyeClose.png
  86. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/group2.png
  87. 17
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/license.txt
  88. BIN
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/rotate.cur
  89. 65
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs
  90. 34
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml
  91. 33
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNode.cs
  92. 20
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineView.xaml
  93. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/GradientSlider.xaml.cs
  94. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/CollectionEditor.xaml.cs
  95. 85
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml
  96. 111
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml.cs
  97. 1
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyContextMenu.xaml
  98. 624
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGrid.cs
  99. 26
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.cs
  100. 578
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml
  101. Some files were not shown because too many files have changed in this diff Show More

9
samples/XamlDesigner/Document.cs

@ -206,7 +206,14 @@ namespace ICSharpCode.XamlDesigner @@ -206,7 +206,14 @@ namespace ICSharpCode.XamlDesigner
{
OutlineRoot = null;
using (var xmlReader = XmlReader.Create(new StringReader(Text))) {
DesignSurface.LoadDesigner(xmlReader, null);
XamlLoadSettings settings = new XamlLoadSettings();
foreach (var assNode in Toolbox.Instance.AssemblyNodes)
{
settings.DesignerAssemblies.Add(assNode.Assembly);
}
settings.TypeFinder = MyTypeFinder.Instance;
DesignSurface.LoadDesigner(xmlReader, settings);
}
if (DesignContext.RootItem != null) {
OutlineRoot = OutlineNode.Create(DesignContext.RootItem);

7
samples/XamlDesigner/MainWindow.xaml

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<Window x:Class="ICSharpCode.XamlDesigner.MainWindow"
<Window x:Class="ICSharpCode.XamlDesigner.MainWindow"
x:Name="root"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@ -112,6 +112,11 @@ @@ -112,6 +112,11 @@
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
<AvalonDock:DockablePane>
<AvalonDock:DockableContent x:Name="content5" Title="Thumbnail">
<sd:ThumbnailView x:Name="uxThumbnailView" DesignSurface="{Binding DataContext.CurrentDocument.DesignSurface, ElementName=root, FallbackValue={x:Null}}" />
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
</AvalonDock:ResizingPanel>
</AvalonDock:DockingManager>
</DockPanel>

49
samples/XamlDesigner/MyTypeFinder.cs

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using ICSharpCode.WpfDesign.XamlDom;
namespace ICSharpCode.XamlDesigner
{
public class MyTypeFinder : XamlTypeFinder
{
public override Assembly LoadAssembly(string name)
{
foreach (var assemblyNode in Toolbox.Instance.AssemblyNodes)
{
if (assemblyNode.Name == name)
return assemblyNode.Assembly;
}
return null;
}
public override XamlTypeFinder Clone()
{
return _instance;
}
private static object lockObj = new object();
private static MyTypeFinder _instance;
public static MyTypeFinder Instance
{
get
{
lock (lockObj)
{
if (_instance == null)
{
_instance = new MyTypeFinder();
_instance.ImportFrom(CreateWpfTypeFinder());
}
}
return _instance;
}
}
}
}

103
samples/XamlDesigner/Toolbox.cs

@ -14,45 +14,47 @@ namespace ICSharpCode.XamlDesigner @@ -14,45 +14,47 @@ namespace ICSharpCode.XamlDesigner
public class Toolbox
{
public Toolbox()
{
AssemblyNodes = new ObservableCollection<AssemblyNode>();
{
AssemblyNodes = new ObservableCollection<AssemblyNode>();
LoadSettings();
}
}
public static Toolbox Instance = new Toolbox();
public ObservableCollection<AssemblyNode> AssemblyNodes { get; private set; }
public ObservableCollection<AssemblyNode> AssemblyNodes { get; private set; }
public void AddAssembly(string path)
{
{
AddAssembly(path, true);
}
void AddAssembly(string path, bool updateSettings)
{
var assembly = Assembly.LoadFile(path);
var node = new AssemblyNode();
node.Assembly = assembly;
node.Path = path;
foreach (var t in assembly.GetExportedTypes()) {
if (IsControl(t) && Metadata.IsPopularControl(t)) {
node.Controls.Add(new ControlNode() { Type = t });
}
}
void AddAssembly(string path, bool updateSettings)
{
var assembly = Assembly.LoadFile(path);
MyTypeFinder.Instance.RegisterAssembly(assembly);
var node = new AssemblyNode();
node.Assembly = assembly;
node.Path = path;
foreach (var t in assembly.GetExportedTypes()) {
if (IsControl(t) /* && Metadata.IsPopularControl(t) */) {
node.Controls.Add(new ControlNode() { Type = t });
}
}
node.Controls.Sort(delegate(ControlNode c1, ControlNode c2) {
return c1.Name.CompareTo(c2.Name);
});
node.Controls.Sort(delegate(ControlNode c1, ControlNode c2) {
return c1.Name.CompareTo(c2.Name);
});
AssemblyNodes.Add(node);
AssemblyNodes.Add(node);
if (updateSettings) {
if (Settings.Default.AssemblyList == null) {
Settings.Default.AssemblyList = new StringCollection();
}
}
Settings.Default.AssemblyList.Add(path);
}
}
}
public void Remove(AssemblyNode node)
{
@ -61,42 +63,47 @@ namespace ICSharpCode.XamlDesigner @@ -61,42 +63,47 @@ namespace ICSharpCode.XamlDesigner
}
public void LoadSettings()
{
{
if (Settings.Default.AssemblyList != null) {
foreach (var path in Settings.Default.AssemblyList) {
AddAssembly(Environment.ExpandEnvironmentVariables(path), false);
try
{
AddAssembly(Environment.ExpandEnvironmentVariables(path), false);
}
catch (Exception ex)
{ }
}
}
}
static bool IsControl(Type t)
{
return !t.IsAbstract && !t.IsGenericTypeDefinition && t.IsSubclassOf(typeof(FrameworkElement));
}
static bool IsControl(Type t)
{
return !t.IsAbstract && !t.IsGenericTypeDefinition && t.IsSubclassOf(typeof(FrameworkElement));
}
}
public class AssemblyNode
{
public AssemblyNode()
{
Controls = new List<ControlNode>();
}
{
public AssemblyNode()
{
Controls = new List<ControlNode>();
}
public Assembly Assembly { get; set; }
public List<ControlNode> Controls { get; private set; }
public string Path { get; set; }
public Assembly Assembly { get; set; }
public List<ControlNode> Controls { get; private set; }
public string Path { get; set; }
public string Name {
get { return Assembly.GetName().Name; }
}
}
public string Name {
get { return Assembly.GetName().Name; }
}
}
public class ControlNode
{
public Type Type { get; set; }
public class ControlNode
{
public Type Type { get; set; }
public string Name {
get { return Type.Name; }
}
}
public string Name {
get { return Type.Name; }
}
}
}

13
samples/XamlDesigner/ToolboxView.xaml

@ -3,18 +3,23 @@ @@ -3,18 +3,23 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Outline="clr-namespace:ICSharpCode.WpfDesign.Designer.OutlineView;assembly=ICSharpCode.WpfDesign.Designer"
xmlns:Default="clr-namespace:ICSharpCode.XamlDesigner">
<UserControl.ContextMenu>
<ContextMenu>
<MenuItem Header="Browse..." Click="BrowseForAssemblies_OnClick"></MenuItem>
</ContextMenu>
</UserControl.ContextMenu>
<UserControl.Resources>
<HierarchicalDataTemplate DataType="{x:Type Default:AssemblyNode}"
ItemsSource="{Binding Controls}">
ItemsSource="{Binding Controls}">
<Outline:IconItem Icon="Images/Reference.png"
Text="{Binding Name}"
ToolTip="{Binding Path}" />
Text="{Binding Name}"
ToolTip="{Binding Path}" />
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type Default:ControlNode}">
<Outline:IconItem Icon="Images/Tag.png"
Text="{Binding Type.Name}" />
Text="{Binding Type.Name}" />
</DataTemplate>
</UserControl.Resources>

17
samples/XamlDesigner/ToolboxView.xaml.cs

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
using System.IO;
using ICSharpCode.WpfDesign.Designer.OutlineView;
using System;
using System.Collections.Generic;
@ -16,6 +17,7 @@ using System.Windows.Media.Imaging; @@ -16,6 +17,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ICSharpCode.WpfDesign.Designer.Services;
using Microsoft.Win32;
namespace ICSharpCode.XamlDesigner
{
@ -73,5 +75,20 @@ namespace ICSharpCode.XamlDesigner @@ -73,5 +75,20 @@ namespace ICSharpCode.XamlDesigner
Toolbox.Instance.Remove(node);
}
}
private void BrowseForAssemblies_OnClick(object sender, RoutedEventArgs e)
{
var dlg = new OpenFileDialog();
dlg.Filter = "Assemblies (*.dll)|*.dll";
dlg.Multiselect = true;
dlg.CheckFileExists = true;
if (dlg.ShowDialog().Value)
{
foreach (var fileName in dlg.FileNames)
{
Toolbox.Instance.AddAssembly(fileName);
}
}
}
}
}

1
samples/XamlDesigner/XamlDesigner.csproj

@ -129,6 +129,7 @@ @@ -129,6 +129,7 @@
</Compile>
<Compile Include="ExtensionMethods.cs" />
<Compile Include="MainWindow_Commands.cs" />
<Compile Include="MyTypeFinder.cs" />
<Compile Include="Shell.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>

12
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 19.07.2012
* Time: 21:27
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using ICSharpCode.Core;
@ -53,4 +49,4 @@ namespace ICSharpCode.CodeAnalysis @@ -53,4 +49,4 @@ namespace ICSharpCode.CodeAnalysis
set { PropertyService.Set("CodeAnalysis.FxCopPath", value); }
}
}
}
}

12
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanel.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 06/09/2012
* Time: 18:27
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Text;
@ -288,4 +284,4 @@ namespace ICSharpCode.CodeAnalysis @@ -288,4 +284,4 @@ namespace ICSharpCode.CodeAnalysis
#endregion
}
}
}

10
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsTreeNodes.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 30.06.2012
* Time: 20:55
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.ObjectModel;
using System.Drawing;

12
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageOptionsPanel.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 09.06.2012
* Time: 17:03
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -108,4 +104,4 @@ namespace ICSharpCode.CodeCoverage @@ -108,4 +104,4 @@ namespace ICSharpCode.CodeCoverage
public ObservableCollection<CodeCoverageDisplayItem> DisplayItems {get; private set;}
}
}
}

12
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageProjectOptionsPanel.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 09.06.2012
* Time: 15:01
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Specialized;
using System.IO;
@ -86,4 +82,4 @@ namespace ICSharpCode.CodeCoverage @@ -86,4 +82,4 @@ namespace ICSharpCode.CodeCoverage
IsDirty = true;
}
}
}
}

5
src/AddIns/Analysis/CodeQuality/Properties/AssemblyInfo.cs

@ -1,4 +1,7 @@ @@ -1,4 +1,7 @@
#region Using directives
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
#region Using directives
using System;
using System.Reflection;

11
src/AddIns/Analysis/CodeQuality/Reporting/BaseReport.cs

@ -1,11 +1,6 @@ @@ -1,11 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 25.02.2012
* Time: 21:04
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.IO;

11
src/AddIns/Analysis/CodeQuality/Reporting/DependencyReport.cs

@ -1,11 +1,6 @@ @@ -1,11 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 25.02.2012
* Time: 21:17
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

11
src/AddIns/Analysis/CodeQuality/Reporting/OverviewReport.cs

@ -1,11 +1,6 @@ @@ -1,11 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 13.02.2012
* Time: 19:46
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

11
src/AddIns/Analysis/CodeQuality/Reporting/ReportViewModel.cs

@ -1,11 +1,6 @@ @@ -1,11 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 26.02.2012
* Time: 18:10
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.CodeQuality.Engine.Dom;

4
src/AddIns/Analysis/MachineSpecifications/MachineSpecifications.Tests/Properties/AssemblyInfo.cs

@ -1,10 +1,14 @@ @@ -1,10 +1,14 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
#region Using directives
using System;
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

2
src/AddIns/Analysis/MachineSpecifications/MachineSpecifications/src/MSpecTestFramework.cs

@ -39,4 +39,4 @@ namespace ICSharpCode.MachineSpecifications @@ -39,4 +39,4 @@ namespace ICSharpCode.MachineSpecifications
return false;
}
}
}
}

12
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 23.07.2012
* Time: 20:13
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -105,4 +101,4 @@ namespace ICSharpCode.SourceAnalysis @@ -105,4 +101,4 @@ namespace ICSharpCode.SourceAnalysis
}
}
}
}
}

12
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 21.07.2012
* Time: 18:51
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -124,4 +120,4 @@ namespace ICSharpCode.SourceAnalysis @@ -124,4 +120,4 @@ namespace ICSharpCode.SourceAnalysis
return newSettingsFile;
}
}
}
}

11
src/AddIns/Analysis/UnitTesting/Test/Project/DoubleNestedTestClassWithBaseType.cs

@ -1,11 +1,6 @@ @@ -1,11 +1,6 @@
/*
* Created by SharpDevelop.
* User: trecio
* Date: 2011-10-23
* Time: 16:15
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Linq;
using ICSharpCode.NRefactory.TypeSystem;

12
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 05/02/2012
* Time: 19:54
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -76,4 +72,4 @@ namespace CSharpBinding.OptionPanels @@ -76,4 +72,4 @@ namespace CSharpBinding.OptionPanels
#endregion
}
}
}

12
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 21.04.2012
* Time: 20:14
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.ComponentModel;
using System.Windows;
@ -170,4 +166,4 @@ namespace ICSharpCode.CppBinding.Project @@ -170,4 +166,4 @@ namespace ICSharpCode.CppBinding.Project
}
}
}
}

12
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 14.04.2012
* Time: 17:53
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.ComponentModel;
using System.Windows;
@ -139,4 +135,4 @@ namespace ICSharpCode.CppBinding.Project @@ -139,4 +135,4 @@ namespace ICSharpCode.CppBinding.Project
IsDirty = true;
}
}
}
}

5
src/AddIns/BackendBindings/JavaScriptBinding/Project/Src/ES3/ES3Lexer.Action.cs

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Globalization;
@ -163,4 +166,4 @@ namespace Xebic.Parsers.ES3 @@ -163,4 +166,4 @@ namespace Xebic.Parsers.ES3
return result;
}
}
}
}

5
src/AddIns/BackendBindings/JavaScriptBinding/Project/Src/ES3/ES3Parser.Action.cs

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Text;
@ -171,4 +174,4 @@ namespace Xebic.Parsers.ES3 @@ -171,4 +174,4 @@ namespace Xebic.Parsers.ES3
}
}
}
}
}

7
src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParsePropertyTests.cs

@ -1,4 +1,7 @@ @@ -1,4 +1,7 @@
using System;
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.PythonBinding;
using ICSharpCode.SharpDevelop.Dom;
using NUnit.Framework;
@ -116,4 +119,4 @@ namespace PythonBinding.Tests.Parsing @@ -116,4 +119,4 @@ namespace PythonBinding.Tests.Parsing
Assert.AreEqual(0, count);
}
}
}
}

2
src/AddIns/Debugger/Debugger.Core/Options.cs

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System.Collections.Generic;
using System;
namespace Debugger
{
public class Options

5
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/UserControls/WizardErrorUserControl.cs

@ -1,4 +1,7 @@ @@ -1,4 +1,7 @@
#region Usings
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
#region Usings
using System;
using System.Collections.Generic;

5
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/EDMObjects/Designer/ChangeWatcher/EDMDesignerChangeWatcher.cs

@ -1,4 +1,7 @@ @@ -1,4 +1,7 @@
#region Usings
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
#region Usings
using System;
using System.Collections.Generic;

5
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/EDMObjects/Designer/ChangeWatcher/IEDMDesignerChangeWatcherObserver.cs

@ -1,4 +1,7 @@ @@ -1,4 +1,7 @@
#region Usings
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
#region Usings
using System;
using System.Collections.Generic;

5
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/IO/EntityModelCodeGenerator.cs

@ -1,4 +1,7 @@ @@ -1,4 +1,7 @@
using System;
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Data.Entity.Design;
using System.Data.Metadata.Edm;

4
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core/ObjectModelConverters/ObjectModelConverterException.cs

@ -1,4 +1,6 @@ @@ -1,4 +1,6 @@

// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;

12
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GeneralOptionsPanel.xaml.cs

@ -1,10 +1,6 @@ @@ -1,10 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 01.05.2012
* Time: 18:31
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
@ -90,4 +86,4 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels @@ -90,4 +86,4 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels
this.generateVSStyleHandlersCheckBox.IsChecked = GenerateVisualStudioStyleEventHandlers;
}
}
}
}

13
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GridOptionsPanel.xaml.cs

@ -1,11 +1,6 @@ @@ -1,11 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 29.02.2012
* Time: 20:20
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Windows;
using ICSharpCode.Core;
@ -86,4 +81,4 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels @@ -86,4 +81,4 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels
EnableGridOptions(false);
}
}
}
}

13
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/LocalizationModelOptionsPanel.xaml.cs

@ -1,11 +1,6 @@ @@ -1,11 +1,6 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 28.02.2012
* Time: 20:08
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.ComponentModel.Design.Serialization;
using ICSharpCode.Core;
@ -70,4 +65,4 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels @@ -70,4 +65,4 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels
}
}
}
}

10
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/MyTypeFinder.cs

@ -25,6 +25,16 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -25,6 +25,16 @@ namespace ICSharpCode.WpfDesign.AddIn
MyTypeFinder f = new MyTypeFinder();
f.file = file;
f.ImportFrom(CreateWpfTypeFinder());
var compilation = SD.ParserService.GetCompilationForFile(file.FileName);
foreach (var referencedAssembly in compilation.ReferencedAssemblies) {
try {
var assembly = Assembly.LoadFrom(referencedAssembly.GetReferenceAssemblyLocation());
f.RegisterAssembly(assembly);
} catch (Exception ex) {
ICSharpCode.Core.LoggingService.Warn("Error loading Assembly : " + referencedAssembly.FullAssemblyName, ex);
}
}
return f;
}

23
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/SharpDevelopTranslations.cs

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.Core;
using System;
using ICSharpCode.WpfDesign.Designer;
namespace ICSharpCode.WpfDesign.AddIn
{
/// <summary>
/// Description of SharpDevelopTranslations.
/// </summary>
public class SharpDevelopTranslations : Translations
{
public override string PressAltText {
get { return StringParser.Parse("${res:AddIns.WpfDesign.AddIn.PressAltText}"); }
}
public static void Init() {
Instance = new SharpDevelopTranslations();
}
}
}

53
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ThumbnailViewPad.cs

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Workbench;
using ICSharpCode.WpfDesign.Designer.ThumbnailView;
namespace ICSharpCode.WpfDesign.AddIn
{
public class ThumbnailViewPad : AbstractPadContent
{
ContentPresenter contentControl = new ContentPresenter();
ThumbnailView thumbnailView = new ThumbnailView();
TextBlock notAvailableTextBlock = new TextBlock {
Text = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.OutlinePad.NotAvailable}"),
TextWrapping = TextWrapping.Wrap
};
public ThumbnailViewPad()
{
SD.Workbench.ActiveViewContentChanged += WorkbenchActiveViewContentChanged;
WorkbenchActiveViewContentChanged(null, null);
}
void WorkbenchActiveViewContentChanged(object sender, EventArgs e)
{
WpfViewContent wpfView = SD.Workbench.ActiveViewContent as WpfViewContent;
if (wpfView != null)
{
thumbnailView.DesignSurface = wpfView.DesignSurface;
SD.WinForms.SetContent(contentControl, thumbnailView);
} else {
SD.WinForms.SetContent(contentControl, notAvailableTextBlock);
}
}
/// <summary>
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
/// </summary>
public override object Control {
get {
return contentControl;
}
}
}
}

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfDisplayBinding.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -52,7 +52,7 @@ namespace ICSharpCode.WpfDesign.AddIn
r.XmlResolver = null;
r.WhitespaceHandling = WhitespaceHandling.None;
while (r.NodeType != XmlNodeType.Element && r.Read());
if (r.LocalName == "ResourceDictionary" || r.LocalName == "Activity")
if (r.LocalName == "ResourceDictionary" || r.LocalName == "Application" || r.LocalName == "Activity")
return false;
} catch (XmlException) {
return true;

50
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfToolbox.cs

@ -2,12 +2,20 @@ @@ -2,12 +2,20 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Forms;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Widgets.SideBar;
using ICSharpCode.SharpDevelop.Workbench;
using WPF = System.Windows.Controls;
namespace ICSharpCode.WpfDesign.AddIn
@ -48,6 +56,48 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -48,6 +56,48 @@ namespace ICSharpCode.WpfDesign.AddIn
sideBar.ActiveTab = sideTab;
}
static bool IsControl(Type t)
{
return !t.IsAbstract && !t.IsGenericTypeDefinition && t.IsSubclassOf(typeof(FrameworkElement));
}
static HashSet<string> addedAssemblys = new HashSet<string>();
public void AddProjectDlls(OpenedFile file)
{
var compilation = SD.ParserService.GetCompilationForFile(file.FileName);
foreach (var reference in compilation.ReferencedAssemblies) {
string f = reference.GetReferenceAssemblyLocation();
if (f != null && !addedAssemblys.Contains(f)) {
try {
var assembly = Assembly.LoadFrom(f);
SideTab sideTab = new SideTab(sideBar, assembly.FullName.Split(new[] {','})[0]);
sideTab.DisplayName = StringParser.Parse(sideTab.Name);
sideTab.CanBeDeleted = false;
sideTab.ChoosedItemChanged += OnChoosedItemChanged;
sideTab.Items.Add(new WpfSideTabItem());
foreach (var t in assembly.GetExportedTypes())
{
if (IsControl(t))
{
sideTab.Items.Add(new WpfSideTabItem(t));
}
}
if (sideTab.Items.Count > 1)
sideBar.Tabs.Add(sideTab);
addedAssemblys.Add(f);
} catch (Exception ex) {
WpfViewContent.DllLoadErrors.Add(new SDTask(new BuildError(f, ex.Message)));
}
}
}
}
void OnChoosedItemChanged(object sender, EventArgs e)
{
if (toolService != null) {

20
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs

@ -20,6 +20,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -20,6 +20,7 @@ using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Parser;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Refactoring;
using ICSharpCode.SharpDevelop.Workbench;
using ICSharpCode.WpfDesign.Designer;
@ -37,11 +38,23 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -37,11 +38,23 @@ namespace ICSharpCode.WpfDesign.AddIn
{
public WpfViewContent(OpenedFile file) : base(file)
{
SharpDevelopTranslations.Init();
BasicMetadata.Register();
WpfToolbox.Instance.AddProjectDlls(file);
ProjectService.ProjectItemAdded += ProjectService_ProjectItemAdded;
this.TabPageText = "${res:FormsDesigner.DesignTabPages.DesignTabPage}";
this.IsActiveViewContentChanged += OnIsActiveViewContentChanged;
}
void ProjectService_ProjectItemAdded(object sender, ProjectItemEventArgs e)
{
if (e.ProjectItem is ReferenceProjectItem)
WpfToolbox.Instance.AddProjectDlls(this.Files[0]);
}
static WpfViewContent()
{
@ -134,6 +147,7 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -134,6 +147,7 @@ namespace ICSharpCode.WpfDesign.AddIn
}
}
public static List<SDTask> DllLoadErrors = new List<SDTask>();
void UpdateTasks(XamlErrorService xamlErrorService)
{
Debug.Assert(xamlErrorService != null);
@ -144,11 +158,13 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -144,11 +158,13 @@ namespace ICSharpCode.WpfDesign.AddIn
tasks.Clear();
foreach (XamlError error in xamlErrorService.Errors) {
var task = new SDTask(PrimaryFile.FileName, error.Message, error.Column - 1, error.Line - 1, TaskType.Error);
var task = new SDTask(PrimaryFile.FileName, error.Message, error.Column - 1, error.Line, TaskType.Error);
tasks.Add(task);
TaskService.Add(task);
}
TaskService.AddRange(DllLoadErrors);
if (xamlErrorService.Errors.Count != 0) {
SD.Workbench.GetPad(typeof(ErrorListPad)).BringPadToFront();
}
@ -226,6 +242,8 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -226,6 +242,8 @@ namespace ICSharpCode.WpfDesign.AddIn
public override void Dispose()
{
ProjectService.ProjectItemAdded -= ProjectService_ProjectItemAdded;
propertyContainer.Clear();
base.Dispose();
}

8
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.AddIn.csproj

@ -68,6 +68,8 @@ @@ -68,6 +68,8 @@
<Compile Include="Src\Commands\Remove.cs" />
<Compile Include="Src\Commands\UndoRedo.cs" />
<Compile Include="Src\Commands\ViewXaml.cs" />
<Compile Include="Src\SharpDevelopTranslations.cs" />
<Compile Include="Src\ThumbnailViewPad.cs" />
<Compile Include="Src\FileUriContext.cs" />
<Compile Include="Src\IdeChooseClassService.cs" />
<Compile Include="Src\ImageSourceEditor\ChooseImageDialog.xaml.cs">
@ -146,9 +148,5 @@ @@ -146,9 +148,5 @@
<Page Include="Src\ImageSourceEditor\ImageSourceEditor.xaml" />
<Page Include="Src\ObjectEditor.xaml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Images" />
<Folder Include="Src\ImageSourceEditor" />
<Folder Include="Src\Commands" />
</ItemGroup>
<ItemGroup />
</Project>

19
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin

@ -1,4 +1,8 @@ @@ -1,4 +1,8 @@
<AddIn name="WPF Designer AddIn" author="Daniel Grunwald" copyright="prj:///doc/copyright.txt" description="WPF Designer" addInManagerHidden="preinstalled">
<AddIn name="WPF Designer AddIn"
author="Daniel Grunwald"
copyright="prj:///doc/copyright.txt"
description="WPF Designer"
addInManagerHidden="preinstalled">
<Manifest>
<Identity name="ICSharpCode.WpfDesigner" />
</Manifest>
@ -20,7 +24,18 @@ @@ -20,7 +24,18 @@
insertbefore = "Text"
fileNamePattern = "\.(xaml)$"
title = "WPF designer"/>-->
<DisplayBinding id="WPFDesigner" type="Secondary" class="ICSharpCode.WpfDesign.AddIn.WpfSecondaryDisplayBinding" fileNamePattern="\.xaml$" />
<DisplayBinding id="WPFDesigner"
type="Secondary"
class="ICSharpCode.WpfDesign.AddIn.WpfSecondaryDisplayBinding"
fileNamePattern="\.xaml$" />
</Path>
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "ThumbnailViewPad"
category = "Main"
title = "${res:ICSharpCode.WpfDesign.AddIn.ThumbnailViewPad}"
icon = "PadIcons.Toolbar"
class = "ICSharpCode.WpfDesign.AddIn.ThumbnailViewPad"
defaultPosition = "Right, Hidden" />
</Path>
<!--
<Path name = "/SharpDevelop/Workbench/Pads">

1
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Configuration/AssemblyInfo.cs

@ -50,3 +50,4 @@ using System.Windows.Markup; @@ -50,3 +50,4 @@ using System.Windows.Markup;
[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.Controls")]
[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.PropertyGrid")]
[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors")]
[assembly: XmlnsDefinition("http://sharpdevelop.net", "ICSharpCode.WpfDesign.Designer.ThumbnailView")]

218
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/CanvasPositionHandle.cs

@ -0,0 +1,218 @@ @@ -0,0 +1,218 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Windows.Input;
using System.Globalization;
using System.ComponentModel;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using System.Windows.Shapes;
using ICSharpCode.WpfDesign.Adorners;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
/// <summary>
/// Adorner that displays the margin of a control in a Grid.
/// </summary>
public class CanvasPositionHandle : MarginHandle
{
static CanvasPositionHandle()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(CanvasPositionHandle), new FrameworkPropertyMetadata(typeof(CanvasPositionHandle)));
HandleLengthOffset=2;
}
private Path line1;
private Path line2;
public override void OnApplyTemplate()
{
line1 = GetTemplateChild("line1") as Path;
line2 = GetTemplateChild("line2") as Path;
base.OnApplyTemplate();
}
readonly Canvas canvas;
readonly DesignItem adornedControlItem;
readonly AdornerPanel adornerPanel;
readonly HandleOrientation orientation;
readonly FrameworkElement adornedControl;
/// <summary> This grid contains the handle line and the endarrow.</summary>
Grid lineArrow;
private DependencyPropertyDescriptor leftDescriptor;
private DependencyPropertyDescriptor rightDescriptor;
private DependencyPropertyDescriptor topDescriptor;
private DependencyPropertyDescriptor bottomDescriptor;
private DependencyPropertyDescriptor widthDescriptor;
private DependencyPropertyDescriptor heightDescriptor;
public CanvasPositionHandle(DesignItem adornedControlItem, AdornerPanel adornerPanel, HandleOrientation orientation)
{
Debug.Assert(adornedControlItem != null);
this.adornedControlItem = adornedControlItem;
this.adornerPanel = adornerPanel;
this.orientation = orientation;
Angle = (double) orientation;
canvas = (Canvas) adornedControlItem.Parent.Component;
adornedControl = (FrameworkElement) adornedControlItem.Component;
Stub = new MarginStub(this);
ShouldBeVisible = true;
leftDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.LeftProperty,
adornedControlItem.Component.GetType());
leftDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
rightDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.RightProperty,
adornedControlItem.Component.GetType());
rightDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
topDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.TopProperty,
adornedControlItem.Component.GetType());
topDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
bottomDescriptor = DependencyPropertyDescriptor.FromProperty(Canvas.BottomProperty,
adornedControlItem.Component.GetType());
bottomDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
widthDescriptor = DependencyPropertyDescriptor.FromProperty(Control.WidthProperty,
adornedControlItem.Component.GetType());
widthDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
heightDescriptor = DependencyPropertyDescriptor.FromProperty(Control.WidthProperty,
adornedControlItem.Component.GetType());
heightDescriptor.AddValueChanged(adornedControl, OnPropertyChanged);
BindAndPlaceHandle();
}
void OnPropertyChanged(object sender, EventArgs e)
{
BindAndPlaceHandle();
}
/// <summary>
/// Gets/Sets the angle by which the Canvas display has to be rotated
/// </summary>
public override double TextTransform
{
get
{
if ((double)orientation == 90 || (double)orientation == 180)
return 180;
if ((double)orientation == 270)
return 0;
return (double)orientation;
}
set { }
}
/// <summary>
/// Binds the <see cref="HandleLength"/> to the margin and place the handles.
/// </summary>
void BindAndPlaceHandle()
{
if (!adornerPanel.Children.Contains(this))
adornerPanel.Children.Add(this);
if (!adornerPanel.Children.Contains(Stub))
adornerPanel.Children.Add(Stub);
RelativePlacement placement=new RelativePlacement();
switch (orientation)
{
case HandleOrientation.Left:
{
var wr = (double) leftDescriptor.GetValue(adornedControl);
if (double.IsNaN(wr))
{
wr = (double) rightDescriptor.GetValue(adornedControl);
wr = canvas.ActualWidth - (adornedControl.ActualWidth + wr);
}
else
{
if (line1 != null)
{
line1.StrokeDashArray.Clear();
line2.StrokeDashArray.Clear();
}
}
this.HandleLength = wr;
placement = new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Center);
placement.XOffset = -HandleLengthOffset;
break;
}
case HandleOrientation.Top:
{
var wr = (double)topDescriptor.GetValue(adornedControl);
if (double.IsNaN(wr))
{
wr = (double)bottomDescriptor.GetValue(adornedControl);
wr = canvas.ActualHeight - (adornedControl.ActualHeight + wr);
}
else
{
if (line1 != null)
{
line1.StrokeDashArray.Clear();
line2.StrokeDashArray.Clear();
}
}
this.HandleLength = wr;
placement = new RelativePlacement(HorizontalAlignment.Center, VerticalAlignment.Top);
placement.YOffset = -HandleLengthOffset;
break;
}
case HandleOrientation.Right:
{
var wr = (double) rightDescriptor.GetValue(adornedControl);
if (double.IsNaN(wr))
{
wr = (double) leftDescriptor.GetValue(adornedControl);
wr = canvas.ActualWidth - (adornedControl.ActualWidth + wr);
}
else
{
if (line1 != null)
{
line1.StrokeDashArray.Clear();
line2.StrokeDashArray.Clear();
}
}
this.HandleLength = wr;
placement = new RelativePlacement(HorizontalAlignment.Right, VerticalAlignment.Center);
placement.XOffset = HandleLengthOffset;
break;
}
case HandleOrientation.Bottom:
{
var wr = (double)bottomDescriptor.GetValue(adornedControl);
if (double.IsNaN(wr))
{
wr = (double)topDescriptor.GetValue(adornedControl);
wr = canvas.ActualHeight - (adornedControl.ActualHeight + wr);
}
else
{
if (line1 != null)
{
line1.StrokeDashArray.Clear();
line2.StrokeDashArray.Clear();
}
}
this.HandleLength = wr;
placement = new RelativePlacement(HorizontalAlignment.Center, VerticalAlignment.Bottom);
placement.YOffset = HandleLengthOffset;
break;
}
}
AdornerPanel.SetPlacement(this, placement);
this.Visibility = Visibility.Visible;
}
}
}

85
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ClearableTextBox.cs

@ -0,0 +1,85 @@ @@ -0,0 +1,85 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
using System.Windows.Data;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
public class ClearableTextBox : EnterTextBox
{
private Button textRemoverButton;
static ClearableTextBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof (ClearableTextBox),
new FrameworkPropertyMetadata(typeof (ClearableTextBox)));
}
public ClearableTextBox()
{
this.GotFocus += this.TextBoxGotFocus;
this.LostFocus += this.TextBoxLostFocus;
this.TextChanged += this.TextBoxTextChanged;
this.KeyUp += this.ClearableTextBox_KeyUp;
}
void ClearableTextBox_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
this.TextRemoverClick(sender, null);
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
this.textRemoverButton = this.GetTemplateChild("TextRemover") as Button;
if (null != this.textRemoverButton)
{
this.textRemoverButton.Click += this.TextRemoverClick;
}
this.UpdateState();
}
protected void UpdateState()
{
if (string.IsNullOrEmpty(this.Text))
{
VisualStateManager.GoToState(this, "TextRemoverHidden", true);
}
else
{
VisualStateManager.GoToState(this, "TextRemoverVisible", true);
}
}
private void TextBoxTextChanged(object sender, TextChangedEventArgs e)
{
this.UpdateState();
}
private void TextRemoverClick(object sender, RoutedEventArgs e)
{
this.Text = string.Empty;
this.Focus();
}
private void TextBoxGotFocus(object sender, RoutedEventArgs e)
{
this.UpdateState();
}
private void TextBoxLostFocus(object sender, RoutedEventArgs e)
{
this.UpdateState();
}
}
}

26
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ContainerDragHandle.cs

@ -9,6 +9,9 @@ using System.Windows.Shapes; @@ -9,6 +9,9 @@ using System.Windows.Shapes;
using System.Windows.Controls.Primitives;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Extensions;
using ICSharpCode.WpfDesign.Designer.Converters;
using System.Globalization;
using System.Windows.Data;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
@ -24,5 +27,28 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -24,5 +27,28 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
//This style is defined in themes\generic.xaml
DefaultStyleKeyProperty.OverrideMetadata(typeof(ContainerDragHandle), new FrameworkPropertyMetadata(typeof(ContainerDragHandle)));
}
private ScaleTransform scaleTransform;
public ContainerDragHandle()
{
scaleTransform = new ScaleTransform(1.0, 1.0);
this.LayoutTransform = scaleTransform;
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
var surface = this.TryFindParent<DesignSurface>();
if (surface != null && surface.ZoomControl != null)
{
var bnd = new Binding("CurrentZoom") { Source = surface.ZoomControl };
bnd.Converter = InvertedZoomConverter.Instance;
BindingOperations.SetBinding(scaleTransform, ScaleTransform.ScaleXProperty, bnd);
BindingOperations.SetBinding(scaleTransform, ScaleTransform.ScaleYProperty, bnd);
}
}
}
}

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

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls" xmlns:ControlConvertors="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls.Converters" xmlns:Converters="clr-namespace:ICSharpCode.WpfDesign.Designer.Converters">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls" xmlns:ControlConvertors="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls.Converters" xmlns:Converters="clr-namespace:ICSharpCode.WpfDesign.Designer.Converters" xmlns:Widgets="http://icsharpcode.net/sharpdevelop/widgets">
<!--
This file contains the default styles used by the Controls in ICSharpCode.WpfDesign.Designer.Controls
-->
@ -16,7 +16,35 @@ @@ -16,7 +16,35 @@
</Style>
<Style TargetType="{x:Type Controls:EnumButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Margin" Value="3 3 0 3" />
<Setter Property="MinWidth" Value="50" />
<Setter Property="Foreground" Value="#FF000000"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid>
<Border x:Name="Background" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid Background="{TemplateBinding Background}">
<Border Opacity="0" x:Name="BackgroundAnimation" Background="#FF448DCA" />
</Grid>
</Border>
<ContentPresenter
x:Name="contentPresenter"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="SkyBlue" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type Controls:ResizeThumb}">
<Setter Property="Template">
@ -39,6 +67,20 @@ @@ -39,6 +67,20 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:RotateThumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:RotateThumb}">
<Grid>
<Rectangle VerticalAlignment="Top" Width="2" Height="30" Fill="Black" Margin="0,0,0,0" />
<Ellipse VerticalAlignment="Top" StrokeThickness="1" Name="thumbRectangle" SnapsToDevicePixels="True" Stroke="Black"
Width="7" Height="7" Fill="Black">
</Ellipse>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:SelectionFrame}">
<Setter Property="Template">
<Setter.Value>
@ -89,7 +131,7 @@ @@ -89,7 +131,7 @@
<Label Margin="4,0,0,0" Content="{TemplateBinding Window.Title}" />
</DockPanel>
<Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
<Border BorderBrush="{TemplateBinding Border.BorderBrush}" BorderThickness="{TemplateBinding Border.BorderThickness}" Background="{TemplateBinding Panel.Background}">
<Border ClipToBounds="True" BorderBrush="{TemplateBinding Border.BorderBrush}" BorderThickness="{TemplateBinding Border.BorderThickness}" Background="{TemplateBinding Panel.Background}">
<AdornerDecorator>
<ContentPresenter ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" Content="{TemplateBinding ContentControl.Content}" />
</AdornerDecorator>
@ -188,6 +230,45 @@ @@ -188,6 +230,45 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:CanvasPositionHandle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:MarginHandle}">
<Grid Height="10" Width="{Binding Path=HandleLength, Converter={x:Static ControlConvertors:HandleLengthWithOffset.Instance}, RelativeSource={RelativeSource Mode=TemplatedParent}}" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Path Name="startArrow" Fill="{StaticResource HandleBrush}" Stretch="Fill" Stroke="{TemplateBinding Panel.Background}" StrokeThickness="0.5" Margin="0,1,0,1" Data="M0,0 L0,1 1,0.5 z" Grid.Column="0" />
<!-- Wrap the handle-line and endArrow in this grid. It's visiblity is subjected to HandleLength -->
<Grid Height="10" Grid.Column="1" Name="lineArrow">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition MaxWidth="20" MinWidth="10" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle Fill="Transparent" Height="10" Grid.Column="0" Grid.ColumnSpan="4" />
<Path Name="line1" StrokeDashArray="2,2" Stretch="Fill" Stroke="{StaticResource HandleBrush}" StrokeThickness="1.5" Margin="0 0 0 0" Data="M0,-0.75 L1,-0.75" Grid.Column="0" />
<TextBlock Grid.Column="1" Text="{Binding Path=HandleLength, Mode=OneWay, Converter={x:Static Converters:FormatDoubleConverter.Instance }, RelativeSource={RelativeSource Mode=TemplatedParent}}" FontSize="9" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="1,1,1,1">
<TextBlock.LayoutTransform>
<RotateTransform Angle="{Binding Path=TextTransform, RelativeSource={RelativeSource Mode=TemplatedParent}}" CenterX="0.5" CenterY="0.5">
</RotateTransform>
</TextBlock.LayoutTransform>
</TextBlock>
<Path Name="line2" StrokeDashArray="2,2" Stretch="Fill" Stroke="{StaticResource HandleBrush}" StrokeThickness="1.5" Margin="0 0 0 0" Data="M0,-0.75 L1,-0.75" Grid.Column="2" />
<!--<Path Name="arrow2" Margin="0,1,0,1" Fill="{StaticResource HandleBrush}" Stretch="Fill" Stroke="{TemplateBinding Panel.Background}" StrokeThickness="0.5" Data="M0,0 L0,1 1,0.5 z" Grid.Column="3" />-->
<!--<Rectangle Width="1.5" Fill="{StaticResource HandleBrush}" Grid.Column="4"/>-->
</Grid>
<!-- Rotate the handle and angle of rotation being set by the Margin type. See enum HandleOrientation -->
<Grid.LayoutTransform>
<RotateTransform Angle="{Binding Path=Angle, RelativeSource={RelativeSource Mode=TemplatedParent}}">
</RotateTransform>
</Grid.LayoutTransform>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:MarginHandle}">
<Setter Property="Template">
<Setter.Value>
@ -285,7 +366,7 @@ @@ -285,7 +366,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:InPlaceEditor}">
<TextBox Name="editor" SnapsToDevicePixels="True" Padding="{Binding Path=Padding}" FontSize="{Binding Path=FontSize}" FontFamily="{Binding Path=FontFamily}" FontStyle="{Binding Path=FontStyle}" FontStretch="{Binding Path=FontStretch}" FontWeight="{Binding Path=FontWight}" Text="{Binding Path=Bind, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" />
<TextBox Name="editor" SnapsToDevicePixels="True" Padding="{Binding Path=Padding}" FontSize="{Binding Path=FontSize}" FontFamily="{Binding Path=FontFamily}" FontStyle="{Binding Path=FontStyle}" FontStretch="{Binding Path=FontStretch}" FontWeight="{Binding Path=FontWeight}" Text="{Binding Path=Bind, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" />
</ControlTemplate>
</Setter.Value>
</Setter>
@ -305,4 +386,234 @@ @@ -305,4 +386,234 @@
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
<Style TargetType="{x:Type Controls:ZoomControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:ZoomControl}">
<Grid Background="{TemplateBinding Panel.Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Widgets:SelfCollapsingPanel Grid.Column="0" Grid.Row="1" CollapseOrientation="Horizontal" CanCollapse="{Binding Path=ComputedZoomButtonCollapsed, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}">
<Widgets:ZoomButtons x:Name="zoomButtons" Value="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}" Minimum="{TemplateBinding MinimumZoom}" Maximum="{TemplateBinding MaximumZoom}" />
</Widgets:SelfCollapsingPanel>
<Rectangle Grid.Column="2" Grid.Row="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
<ScrollContentPresenter Name="PART_Presenter" Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0" Margin="{TemplateBinding Control.Padding}" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}">
<ScrollContentPresenter.LayoutTransform>
<ScaleTransform ScaleX="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}" ScaleY="{Binding Path=CurrentZoom, RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
</ScrollContentPresenter.LayoutTransform>
</ScrollContentPresenter>
<ContentControl Grid.Column="1" Grid.Row="1" Content="{TemplateBinding AdditionalControls}" />
<ScrollBar Name="PART_VerticalScrollBar" Grid.Column="3" Grid.Row="0" Minimum="0" Maximum="{TemplateBinding ScrollableHeight}" ViewportSize="{TemplateBinding ViewportHeight}" Value="{TemplateBinding VerticalOffset}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" />
<ScrollBar Name="PART_HorizontalScrollBar" Orientation="Horizontal" Grid.Column="2" Grid.Row="1" Minimum="0" Maximum="{TemplateBinding ScrollableWidth}" ViewportSize="{TemplateBinding ViewportWidth}" Value="{TemplateBinding HorizontalOffset}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Button}" x:Key="ClearButtonStyle">
<Setter Property="Background" Value="#FFaaaaaa" />
<Setter Property="BorderBrush" Value="#FFaaaaaa" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Width="14" Height="14">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused" />
<VisualState x:Name="Unfocused" />
</VisualStateGroup>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="00:00:00.2000000" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Duration="0"
Storyboard.TargetName="ellipseHighlight"
Storyboard.TargetProperty="(UIElement.Opacity)"
To="1" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation Duration="0"
Storyboard.TargetName="ellipseHighlight"
Storyboard.TargetProperty="(UIElement.Opacity)"
To="1" />
<DoubleAnimation Duration="0"
Storyboard.TargetName="pathHighlight"
Storyboard.TargetProperty="(UIElement.Opacity)"
To="1" />
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Ellipse x:Name="ellipse"
Fill="{TemplateBinding Background}"
Stroke="{TemplateBinding BorderBrush}" />
<Ellipse x:Name="ellipseHighlight"
Fill="#FFBD7777"
Opacity="0"
Stroke="Red" />
<Path x:Name="path"
Margin="4.5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M0.5,0.5 L8.5,8.5 M8.5000095,0.50000072 L0.50000954,8.500001"
Stretch="Fill"
Stroke="{TemplateBinding Foreground}"
UseLayoutRounding="False" />
<Path x:Name="pathHighlight"
Margin="4.5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M0.5,0.5 L8.5,8.5 M8.5000095,0.50000072 L0.50000954,8.500001"
Opacity="0"
Stretch="Fill"
Stroke="Red"
UseLayoutRounding="False" />
<ContentPresenter x:Name="contentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Visibility="Collapsed" />
<Rectangle x:Name="DisabledVisualElement"
Fill="#FFFFFFFF"
IsHitTestVisible="false"
Opacity="0"
RadiusX="3"
RadiusY="3" />
<Rectangle x:Name="FocusVisualElement"
Margin="1"
IsHitTestVisible="false"
Opacity="0"
RadiusX="2"
RadiusY="2"
Stroke="#FF6DBDD1"
StrokeThickness="1" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:ClearableTextBox}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
<Setter Property="BorderBrush" Value="#888" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="1,0,0,0" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:ClearableTextBox}">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="TextRemoverStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="00:00:00.3000000" />
</VisualStateGroup.Transitions>
<VisualState x:Name="TextRemoverVisible">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Duration="00:00:00.0010000"
Storyboard.TargetName="TextRemover"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Duration="00:00:00.0010000"
Storyboard.TargetName="TextRemover"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Duration="00:00:00.0010000"
Storyboard.TargetName="TextRemover"
Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="TextRemoverHidden">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Duration="00:00:00.0010000"
Storyboard.TargetName="TextRemover"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Duration="00:00:00.0010000"
Storyboard.TargetName="TextRemover"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Duration="00:00:00.0010000"
Storyboard.TargetName="TextRemover"
Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="1" />
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"
Margin="0,0,18,0"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Viewbox Stretch="Uniform" HorizontalAlignment="Right" VerticalAlignment="Stretch" Margin="0,3,3,3">
<Button x:Name="TextRemover"
Width="14"
Height="14"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsTabStop="False"
RenderTransformOrigin="0.5,0.5"
Style="{StaticResource ClearButtonStyle}">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1" />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Button.RenderTransform>
</Button>
</Viewbox>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Controls:RenderTransformOriginThumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Controls:RenderTransformOriginThumb}">
<Grid Width="10" Height="10" Margin="-5,-5,-5,-5">
<Ellipse Width="2" Height="2" Fill="Black"/>
<Ellipse Width="10" Height="10" Fill="Transparent" Stroke="Black" StrokeThickness="1" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/GrayOutDesignerExceptActiveArea.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
using System.Windows.Media.Animation;
@ -78,7 +79,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -78,7 +79,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
if (designPanel != null && grayOut == null && optionService != null && optionService.GrayOutDesignSurfaceExceptParentContainerWhenDragging) {
grayOut = new GrayOutDesignerExceptActiveArea();
grayOut.designSurfaceRectangle = new RectangleGeometry(
new Rect(new Point(0, 0), designPanel.RenderSize));
new Rect(0, 0, ((Border)designPanel.Child).Child.RenderSize.Width, ((Border)designPanel.Child).Child.RenderSize.Height));
grayOut.designPanel = designPanel;
grayOut.adornerPanel = new AdornerPanel();
grayOut.adornerPanel.Order = AdornerOrder.BehindForeground;

101
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/InfoTextEnterArea.cs

@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
using System.Windows.Media.Animation;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Services;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
/// <summary>
/// Gray out everything except a specific area.
/// </summary>
sealed class InfoTextEnterArea : FrameworkElement
{
Geometry designSurfaceRectangle;
Geometry activeAreaGeometry;
Geometry combinedGeometry;
AdornerPanel adornerPanel;
IDesignPanel designPanel;
const double MaxOpacity = 0.3;
public InfoTextEnterArea()
{
this.IsHitTestVisible = false;
}
public Geometry ActiveAreaGeometry {
get { return activeAreaGeometry; }
set {
activeAreaGeometry = value;
combinedGeometry = activeAreaGeometry;
}
}
Rect currentAnimateActiveAreaRectToTarget;
internal void AnimateActiveAreaRectTo(Rect newRect)
{
if (newRect.Equals(currentAnimateActiveAreaRectToTarget))
return;
activeAreaGeometry.BeginAnimation(
RectangleGeometry.RectProperty,
new RectAnimation(newRect, new Duration(new TimeSpan(0,0,0,0,100))),
HandoffBehavior.SnapshotAndReplace);
currentAnimateActiveAreaRectToTarget = newRect;
}
internal static void Start(ref InfoTextEnterArea grayOut, ServiceContainer services, UIElement activeContainer, string text)
{
Debug.Assert(activeContainer != null);
Start(ref grayOut, services, activeContainer, new Rect(activeContainer.RenderSize), text);
}
internal static void Start(ref InfoTextEnterArea grayOut, ServiceContainer services, UIElement activeContainer, Rect activeRectInActiveContainer, string text)
{
Debug.Assert(services != null);
Debug.Assert(activeContainer != null);
DesignPanel designPanel = services.GetService<IDesignPanel>() as DesignPanel;
OptionService optionService = services.GetService<OptionService>();
if (designPanel != null && grayOut == null && optionService != null && optionService.GrayOutDesignSurfaceExceptParentContainerWhenDragging) {
grayOut = new InfoTextEnterArea();
grayOut.designSurfaceRectangle = new RectangleGeometry(
new Rect(0, 0, ((Border)designPanel.Child).Child.RenderSize.Width, ((Border)designPanel.Child).Child.RenderSize.Height));
grayOut.designPanel = designPanel;
grayOut.adornerPanel = new AdornerPanel();
grayOut.adornerPanel.Order = AdornerOrder.Background;
grayOut.adornerPanel.SetAdornedElement(designPanel.Context.RootItem.View, null);
grayOut.ActiveAreaGeometry = new RectangleGeometry(activeRectInActiveContainer, 0, 0, (Transform)activeContainer.TransformToVisual(grayOut.adornerPanel.AdornedElement));
var tb = new TextBlock(){Text = text};
tb.FontSize = 10;
tb.ClipToBounds = true;
tb.Width = ((FrameworkElement) activeContainer).ActualWidth;
tb.Height = ((FrameworkElement) activeContainer).ActualHeight;
tb.VerticalAlignment = VerticalAlignment.Top;
tb.HorizontalAlignment = HorizontalAlignment.Left;
tb.RenderTransform = (Transform)activeContainer.TransformToVisual(grayOut.adornerPanel.AdornedElement);
grayOut.adornerPanel.Children.Add(tb);
designPanel.Adorners.Add(grayOut.adornerPanel);
}
}
static readonly TimeSpan animationTime = new TimeSpan(2000000);
internal static void Stop(ref InfoTextEnterArea grayOut)
{
if (grayOut != null) {
IDesignPanel designPanel = grayOut.designPanel;
AdornerPanel adornerPanelToRemove = grayOut.adornerPanel;
designPanel.Adorners.Remove(adornerPanelToRemove);
grayOut = null;
}
}
}
}

7
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/MarginHandle.cs

@ -60,7 +60,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -60,7 +60,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
/// <summary>
/// Gets the Stub for this handle
/// </summary>
public MarginStub Stub {get; private set;}
public MarginStub Stub {get; protected set;}
/// <summary>
/// Gets/Sets the angle by which handle rotates.
@ -70,7 +70,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -70,7 +70,7 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
/// <summary>
/// Gets/Sets the angle by which the Margin display has to be rotated
/// </summary>
public double TextTransform{
public virtual double TextTransform{
get{
if((double)orientation==90 || (double)orientation == 180)
return 180;
@ -109,6 +109,9 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -109,6 +109,9 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
get { return orientation; }
}
protected MarginHandle()
{ }
public MarginHandle(DesignItem adornedControlItem, AdornerPanel adornerPanel, HandleOrientation orientation)
{
Debug.Assert(adornedControlItem!=null);

28
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/PanelMoveAdorner.cs

@ -9,6 +9,10 @@ using System.Windows.Controls; @@ -9,6 +9,10 @@ using System.Windows.Controls;
using System.Windows;
using System.Windows.Input;
using ICSharpCode.WpfDesign.Designer.Services;
using System.Windows.Media;
using ICSharpCode.WpfDesign.Designer.Converters;
using System.Globalization;
using System.Windows.Data;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
@ -17,12 +21,17 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -17,12 +21,17 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
static PanelMoveAdorner()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PanelMoveAdorner),
new FrameworkPropertyMetadata(typeof(PanelMoveAdorner)));
new FrameworkPropertyMetadata(typeof(PanelMoveAdorner)));
}
private ScaleTransform scaleTransform;
public PanelMoveAdorner(DesignItem item)
{
this.item = item;
scaleTransform = new ScaleTransform(1.0, 1.0);
this.LayoutTransform = scaleTransform;
}
DesignItem item;
@ -30,8 +39,23 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -30,8 +39,23 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
e.Handled = true;
item.Services.Selection.SetSelectedComponents(new DesignItem [] { item }, SelectionTypes.Auto);
item.Services.Selection.SetSelectedComponents(new DesignItem [] { item }, SelectionTypes.Auto);
new DragMoveMouseGesture(item, false).Start(item.Services.DesignPanel, e);
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
var surface = this.TryFindParent<DesignSurface>();
if (surface != null && surface.ZoomControl != null)
{
var bnd = new Binding("CurrentZoom") {Source = surface.ZoomControl};
bnd.Converter = InvertedZoomConverter.Instance;
BindingOperations.SetBinding(scaleTransform, ScaleTransform.ScaleXProperty, bnd);
BindingOperations.SetBinding(scaleTransform, ScaleTransform.ScaleYProperty, bnd);
}
}
}
}

227
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/QuickOperationMenu.cs

@ -6,6 +6,11 @@ using System.Collections.Generic; @@ -6,6 +6,11 @@ using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.WpfDesign.Designer.Converters;
using System.Globalization;
using System.Windows.Data;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
@ -13,106 +18,124 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -13,106 +18,124 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
/// A Small icon which shows up a menu containing common properties
/// </summary>
public class QuickOperationMenu : Control
{
static QuickOperationMenu()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof (QuickOperationMenu), new FrameworkPropertyMetadata(typeof (QuickOperationMenu)));
}
private MenuItem _mainHeader;
/// <summary>
/// Contains Default values in the Sub menu for example "HorizontalAlignment" has "HorizontalAlignment.Stretch" as it's value.
/// </summary>
private readonly Dictionary<MenuItem, MenuItem> _defaults = new Dictionary<MenuItem, MenuItem>();
/// <summary>
/// Is the main header menu which brings up all the menus.
/// </summary>
public MenuItem MainHeader {
get { return _mainHeader; }
}
/// <summary>
/// Add a submenu with checkable values.
/// </summary>
/// <param name="parent">The parent menu under which to add.</param>
/// <param name="enumValues">All the values of an enum to be showed in the menu</param>
/// <param name="defaultValue">The default value out of all the enums.</param>
/// <param name="setValue">The presently set value out of the enums</param>
public void AddSubMenuCheckable(MenuItem parent, Array enumValues, string defaultValue, string setValue)
{
foreach (var enumValue in enumValues) {
var menuItem = new MenuItem {Header = enumValue.ToString(), IsCheckable = true};
parent.Items.Add(menuItem);
if (enumValue.ToString() == defaultValue)
_defaults.Add(parent, menuItem);
if (enumValue.ToString() == setValue)
menuItem.IsChecked = true;
}
}
/// <summary>
/// Add a menu in the main header.
/// </summary>
/// <param name="menuItem">The menu to add.</param>
public void AddSubMenuInTheHeader(MenuItem menuItem)
{
if (_mainHeader != null)
_mainHeader.Items.Add(menuItem);
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
var mainHeader = Template.FindName("MainHeader", this) as MenuItem;
if (mainHeader != null) {
_mainHeader = mainHeader;
}
}
/// <summary>
/// Checks a menu item and making it exclusive. If the check was toggled then the default menu item is selected.
/// </summary>
/// <param name="parent">The parent item of the sub menu</param>
/// <param name="clickedOn">The Item clicked on</param>
/// <returns>Returns the Default value if the checkable menu item is toggled or otherwise the new checked menu item.</returns>
public string UncheckChildrenAndSelectClicked(MenuItem parent, MenuItem clickedOn)
{
MenuItem defaultMenuItem;
_defaults.TryGetValue(parent, out defaultMenuItem);
if (IsAnyItemChecked(parent)) {
foreach (var item in parent.Items) {
var menuItem = item as MenuItem;
if (menuItem != null) menuItem.IsChecked = false;
}
clickedOn.IsChecked = true;
return (string) clickedOn.Header;
} else {
if (defaultMenuItem != null) {
defaultMenuItem.IsChecked = true;
return (string) defaultMenuItem.Header;
}
}
return null;
}
/// <summary>
/// Checks in the sub-menu whether aby items has been checked or not
/// </summary>
/// <param name="parent"></param>
/// <returns></returns>
private bool IsAnyItemChecked(MenuItem parent)
{
bool check = false;
if (parent.HasItems) {
foreach (var item in parent.Items) {
var menuItem = item as MenuItem;
if (menuItem != null && menuItem.IsChecked)
check = true;
}
}
return check;
}
}
{
static QuickOperationMenu()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof (QuickOperationMenu), new FrameworkPropertyMetadata(typeof (QuickOperationMenu)));
}
public QuickOperationMenu()
{
scaleTransform = new ScaleTransform(1.0, 1.0);
this.LayoutTransform = scaleTransform;
}
private ScaleTransform scaleTransform;
private MenuItem _mainHeader;
/// <summary>
/// Contains Default values in the Sub menu for example "HorizontalAlignment" has "HorizontalAlignment.Stretch" as it's value.
/// </summary>
private readonly Dictionary<MenuItem, MenuItem> _defaults = new Dictionary<MenuItem, MenuItem>();
/// <summary>
/// Is the main header menu which brings up all the menus.
/// </summary>
public MenuItem MainHeader {
get { return _mainHeader; }
}
/// <summary>
/// Add a submenu with checkable values.
/// </summary>
/// <param name="parent">The parent menu under which to add.</param>
/// <param name="enumValues">All the values of an enum to be showed in the menu</param>
/// <param name="defaultValue">The default value out of all the enums.</param>
/// <param name="setValue">The presently set value out of the enums</param>
public void AddSubMenuCheckable(MenuItem parent, Array enumValues, string defaultValue, string setValue)
{
foreach (var enumValue in enumValues) {
var menuItem = new MenuItem {Header = enumValue.ToString(), IsCheckable = true};
parent.Items.Add(menuItem);
if (enumValue.ToString() == defaultValue)
_defaults.Add(parent, menuItem);
if (enumValue.ToString() == setValue)
menuItem.IsChecked = true;
}
}
/// <summary>
/// Add a menu in the main header.
/// </summary>
/// <param name="menuItem">The menu to add.</param>
public void AddSubMenuInTheHeader(MenuItem menuItem)
{
if (_mainHeader != null)
_mainHeader.Items.Add(menuItem);
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
var mainHeader = Template.FindName("MainHeader", this) as MenuItem;
if (mainHeader != null) {
_mainHeader = mainHeader;
}
var surface = this.TryFindParent<DesignSurface>();
if (surface != null && surface.ZoomControl != null)
{
var bnd = new Binding("CurrentZoom") { Source = surface.ZoomControl };
bnd.Converter = InvertedZoomConverter.Instance;
BindingOperations.SetBinding(scaleTransform, ScaleTransform.ScaleXProperty, bnd);
BindingOperations.SetBinding(scaleTransform, ScaleTransform.ScaleYProperty, bnd);
}
}
/// <summary>
/// Checks a menu item and making it exclusive. If the check was toggled then the default menu item is selected.
/// </summary>
/// <param name="parent">The parent item of the sub menu</param>
/// <param name="clickedOn">The Item clicked on</param>
/// <returns>Returns the Default value if the checkable menu item is toggled or otherwise the new checked menu item.</returns>
public string UncheckChildrenAndSelectClicked(MenuItem parent, MenuItem clickedOn)
{
MenuItem defaultMenuItem;
_defaults.TryGetValue(parent, out defaultMenuItem);
if (IsAnyItemChecked(parent)) {
foreach (var item in parent.Items) {
var menuItem = item as MenuItem;
if (menuItem != null) menuItem.IsChecked = false;
}
clickedOn.IsChecked = true;
return (string) clickedOn.Header;
} else {
if (defaultMenuItem != null) {
defaultMenuItem.IsChecked = true;
return (string) defaultMenuItem.Header;
}
}
return null;
}
/// <summary>
/// Checks in the sub-menu whether aby items has been checked or not
/// </summary>
/// <param name="parent"></param>
/// <returns></returns>
private bool IsAnyItemChecked(MenuItem parent)
{
bool check = false;
if (parent.HasItems) {
foreach (var item in parent.Items) {
var menuItem = item as MenuItem;
if (menuItem != null && menuItem.IsChecked)
check = true;
}
}
return check;
}
}
}

28
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/RenderTransformOriginThumb.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Extensions;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
/// <summary>
/// Description of RenderTransformThumb.
/// </summary>
public class RenderTransformOriginThumb : Thumb
{
static RenderTransformOriginThumb()
{
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
//This style is defined in themes\generic.xaml
DefaultStyleKeyProperty.OverrideMetadata(typeof(RenderTransformOriginThumb), new FrameworkPropertyMetadata(typeof(RenderTransformOriginThumb)));
}
}
}

38
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/RotateThumb.cs

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Extensions;
namespace ICSharpCode.WpfDesign.Designer.Controls
{
public class RotateThumb : ResizeThumb
{
private double initialAngle;
private RotateTransform rotateTransform;
private Vector startVector;
private Point centerPoint;
private Control designerItem;
private Panel canvas;
private AdornerPanel parent;
static RotateThumb()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(RotateThumb), new FrameworkPropertyMetadata(typeof(RotateThumb)));
}
public RotateThumb()
{
this.ResizeThumbVisible = true;
}
}
}

12
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Controls/ZoomControl.cs

@ -18,9 +18,19 @@ namespace ICSharpCode.WpfDesign.Designer.Controls @@ -18,9 +18,19 @@ namespace ICSharpCode.WpfDesign.Designer.Controls
{
PanToolCursor = GetCursor("Images/PanToolCursor.cur");
PanToolCursorMouseDown = GetCursor("Images/PanToolCursorMouseDown.cur");
DefaultStyleKeyProperty.OverrideMetadata(typeof(ZoomControl), new FrameworkPropertyMetadata(typeof(ZoomControl)));
}
public object AdditionalControls
{
get { return (object)GetValue(AdditionalControlsProperty); }
set { SetValue(AdditionalControlsProperty, value); }
}
static Cursor GetCursor(string path)
public static readonly DependencyProperty AdditionalControlsProperty =
DependencyProperty.Register("AdditionalControls", typeof(object), typeof(ZoomControl), new PropertyMetadata(null));
internal static Cursor GetCursor(string path)
{
var a = Assembly.GetExecutingAssembly();
var m = new ResourceManager(a.GetName().Name + ".g", a);

113
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Converters.cs

@ -9,6 +9,7 @@ using System.Windows.Data; @@ -9,6 +9,7 @@ using System.Windows.Data;
using System.Globalization;
using System.Windows;
using System.Collections;
using System.Windows.Media;
namespace ICSharpCode.WpfDesign.Designer.Converters
{
@ -85,7 +86,7 @@ namespace ICSharpCode.WpfDesign.Designer.Converters @@ -85,7 +86,7 @@ namespace ICSharpCode.WpfDesign.Designer.Converters
{
if (value == null || (int)value == 0) {
return Visibility.Collapsed;
}
}
return Visibility.Visible;
}
@ -145,17 +146,109 @@ namespace ICSharpCode.WpfDesign.Designer.Converters @@ -145,17 +146,109 @@ namespace ICSharpCode.WpfDesign.Designer.Converters
}
public class FormatDoubleConverter : IValueConverter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "converter is immutable")]
public static readonly FormatDoubleConverter Instance=new FormatDoubleConverter();
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "converter is immutable")]
public static readonly FormatDoubleConverter Instance=new FormatDoubleConverter();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return Math.Round((double)value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class BlackWhenTrue : IValueConverter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "converter is immutable")]
public static readonly BlackWhenTrue Instance = new BlackWhenTrue();
private Brush black = new SolidColorBrush(Colors.Black);
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value ? black : null;
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return Math.Round((double)value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
public class EnumBoolean : IValueConverter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "converter is immutable")]
public static readonly EnumBoolean Instance = new EnumBoolean();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string parameterString = parameter as string;
if (parameterString == null)
return DependencyProperty.UnsetValue;
if (Enum.IsDefined(value.GetType(), value) == false)
return DependencyProperty.UnsetValue;
object parameterValue = Enum.Parse(value.GetType(), parameterString);
return parameterValue.Equals(value);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string parameterString = parameter as string;
if (parameterString == null)
return DependencyProperty.UnsetValue;
return Enum.Parse(targetType, parameterString);
}
}
public class EnumVisibility : IValueConverter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "converter is immutable")]
public static readonly EnumVisibility Instance = new EnumVisibility();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string parameterString = parameter as string;
if (parameterString == null)
return DependencyProperty.UnsetValue;
if (Enum.IsDefined(value.GetType(), value) == false)
return DependencyProperty.UnsetValue;
object parameterValue = Enum.Parse(value.GetType(), parameterString);
return parameterValue.Equals(value) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string parameterString = parameter as string;
if (parameterString == null)
return DependencyProperty.UnsetValue;
return Enum.Parse(targetType, parameterString);
}
}
public class InvertedZoomConverter : IValueConverter
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "converter is immutable")]
public static readonly InvertedZoomConverter Instance = new InvertedZoomConverter();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return 1.0 / ((double)value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return 1.0 / ((double)value);
}
}
}

97
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignPanel.cs

@ -16,7 +16,7 @@ using ICSharpCode.WpfDesign.Designer.Controls; @@ -16,7 +16,7 @@ using ICSharpCode.WpfDesign.Designer.Controls;
namespace ICSharpCode.WpfDesign.Designer
{
sealed class DesignPanel : Decorator, IDesignPanel
public sealed class DesignPanel : Decorator, IDesignPanel, INotifyPropertyChanged
{
#region Hit Testing
/// <summary>
@ -147,6 +147,9 @@ namespace ICSharpCode.WpfDesign.Designer @@ -147,6 +147,9 @@ namespace ICSharpCode.WpfDesign.Designer
};
_eatAllHitTestRequests.AllowDrop = true;
_adornerLayer = new AdornerLayer(this);
this.PreviewKeyUp += DesignPanel_KeyUp;
this.PreviewKeyDown += DesignPanel_KeyDown;
}
#endregion
@ -182,6 +185,48 @@ namespace ICSharpCode.WpfDesign.Designer @@ -182,6 +185,48 @@ namespace ICSharpCode.WpfDesign.Designer
set { _adornerLayer.IsHitTestVisible = value; }
}
/// <summary>
/// Enables / Disables the Snapline Placement
/// </summary>
private bool _useSnaplinePlacement = true;
public bool UseSnaplinePlacement {
get { return _useSnaplinePlacement; }
set {
if (_useSnaplinePlacement != value) {
_useSnaplinePlacement = value;
OnPropertyChanged("UseSnaplinePlacement");
}
}
}
/// <summary>
/// Enables / Disables the Raster Placement
/// </summary>
private bool _useRasterPlacement = false;
public bool UseRasterPlacement {
get { return _useRasterPlacement; }
set {
if (_useRasterPlacement != value) {
_useRasterPlacement = value;
OnPropertyChanged("UseRasterPlacement");
}
}
}
/// <summary>
/// Sets the with of the Raster when using Raster Placement
/// </summary>
private int _rasterWidth = 5;
public int RasterWidth {
get { return _rasterWidth; }
set {
if (_rasterWidth != value) {
_rasterWidth = value;
OnPropertyChanged("RasterWidth");
}
}
}
#endregion
#region Visual Child Management
@ -249,6 +294,49 @@ namespace ICSharpCode.WpfDesign.Designer @@ -249,6 +294,49 @@ namespace ICSharpCode.WpfDesign.Designer
}
#endregion
private void DesignPanel_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Left || e.Key == Key.Right || e.Key == Key.Up || e.Key == Key.Down)
{
e.Handled = true;
}
}
void DesignPanel_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Left || e.Key == Key.Right || e.Key == Key.Up || e.Key == Key.Down)
{
e.Handled = true;
var placementOp = PlacementOperation.Start(Context.Services.Selection.SelectedItems, PlacementType.Move);
var dx1 = (e.Key == Key.Left) ? Keyboard.IsKeyDown(Key.LeftShift) ? -10 : -1 : 0;
var dy1 = (e.Key == Key.Up) ? Keyboard.IsKeyDown(Key.LeftShift) ? -10 : -1 : 0;
var dx2 = (e.Key == Key.Right) ? Keyboard.IsKeyDown(Key.LeftShift) ? 10 : 1 : 0;
var dy2 = (e.Key == Key.Down) ? Keyboard.IsKeyDown(Key.LeftShift) ? 10 : 1 : 0;
foreach (PlacementInformation info in placementOp.PlacedItems)
{
if (!Keyboard.IsKeyDown(Key.LeftCtrl))
{
info.Bounds = new Rect(info.OriginalBounds.Left + dx1 + dx2,
info.OriginalBounds.Top + dy1 + dy2,
info.OriginalBounds.Width,
info.OriginalBounds.Height);
}
else
{
info.Bounds = new Rect(info.OriginalBounds.Left,
info.OriginalBounds.Top,
info.OriginalBounds.Width + dx1 + dx2,
info.OriginalBounds.Height + dy1 + dy2);
}
placementOp.CurrentContainerBehavior.SetPosition(info);
}
}
}
protected override void OnQueryCursor(QueryCursorEventArgs e)
{
base.OnQueryCursor(e);
@ -260,5 +348,12 @@ namespace ICSharpCode.WpfDesign.Designer @@ -260,5 +348,12 @@ namespace ICSharpCode.WpfDesign.Designer
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}

75
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs → src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.cs

@ -17,6 +17,8 @@ using System.Windows.Shapes; @@ -17,6 +17,8 @@ using System.Windows.Shapes;
using System.Xml;
using ICSharpCode.WpfDesign.Designer.Xaml;
using ICSharpCode.WpfDesign.Designer.Services;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Controls;
using System.Diagnostics;
using ICSharpCode.WpfDesign.XamlDom;
using System.Threading;
@ -27,18 +29,21 @@ namespace ICSharpCode.WpfDesign.Designer @@ -27,18 +29,21 @@ namespace ICSharpCode.WpfDesign.Designer
/// <summary>
/// Surface hosting the WPF designer.
/// </summary>
public partial class DesignSurface
[TemplatePart(Name = "PART_DesignContent", Type = typeof(ContentControl))]
[TemplatePart(Name = "PART_Zoom", Type = typeof(ZoomControl))]
public class DesignSurface : ContentControl
{
private FocusNavigator _focusNav;
static DesignSurface()
{
//TODO: this is for converters (see PropertyGrid)
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
DefaultStyleKeyProperty.OverrideMetadata(typeof(DesignSurface), new FrameworkPropertyMetadata(typeof(DesignSurface)));
}
public DesignSurface()
{
InitializeComponent();
//TODO: this is for converters (see PropertyGrid)
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
this.AddCommandHandler(ApplicationCommands.Undo, Undo, CanUndo);
this.AddCommandHandler(ApplicationCommands.Redo, Redo, CanRedo);
@ -48,23 +53,42 @@ namespace ICSharpCode.WpfDesign.Designer @@ -48,23 +53,42 @@ namespace ICSharpCode.WpfDesign.Designer
this.AddCommandHandler(ApplicationCommands.Paste, Paste, CanPaste);
this.AddCommandHandler(ApplicationCommands.SelectAll, SelectAll, CanSelectAll);
#if DEBUG || CODE_ANALYSIS
if (_designPanel == null) {
Environment.FailFast("designpanel should be initialized earlier");
// Fake call to DesignPanel constructor because FxCop doesn't look inside XAML files
// and we'd get tons of warnings about uncalled private code.
_designPanel = new DesignPanel();
}
#endif
_sceneContainer = new Border() { AllowDrop = false, UseLayoutRounding = true };
_sceneContainer.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Ideal);
_designPanel = new DesignPanel() {Child = _sceneContainer};
}
internal DesignPanel _designPanel;
private ContentControl _partDesignContent;
private Border _sceneContainer;
public override void OnApplyTemplate()
{
_partDesignContent = this.Template.FindName("PART_DesignContent", this) as ContentControl;
_partDesignContent.Content = _designPanel;
_partDesignContent.RequestBringIntoView += _partDesignContent_RequestBringIntoView;
this.ZoomControl = this.Template.FindName("PART_Zoom", this) as ZoomControl;
base.OnApplyTemplate();
}
void _partDesignContent_RequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
{
e.Handled = true;
}
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
{
if (e.OriginalSource == uxZoom) {
if (ZoomControl != null && e.OriginalSource == ZoomControl)
{
UnselectAll();
}
}
public ZoomControl ZoomControl { get; private set; }
DesignContext _designContext;
/// <summary>
@ -74,6 +98,13 @@ namespace ICSharpCode.WpfDesign.Designer @@ -74,6 +98,13 @@ namespace ICSharpCode.WpfDesign.Designer
get { return _designContext; }
}
/// <summary>
/// Gets the DesignPanel
/// </summary>
public DesignPanel DesignPanel {
get { return _designPanel; }
}
/// <summary>
/// Initializes the designer content from the specified XmlReader.
/// </summary>
@ -127,7 +158,7 @@ namespace ICSharpCode.WpfDesign.Designer @@ -127,7 +158,7 @@ namespace ICSharpCode.WpfDesign.Designer
IDisposable d = o as IDisposable;
if (d != null) d.Dispose();
}
}
}
_designContext = null;
_designPanel.Context = null;
_sceneContainer.Child = null;
@ -170,18 +201,18 @@ namespace ICSharpCode.WpfDesign.Designer @@ -170,18 +201,18 @@ namespace ICSharpCode.WpfDesign.Designer
{
ISelectionService selectionService = GetService<ISelectionService>();
if(selectionService!=null){
if (selectionService.SelectedItems.Count == 0)
return false;
if (selectionService.SelectedItems.Count == 1 && selectionService.PrimarySelection == DesignContext.RootItem)
return false;
if (selectionService.SelectedItems.Count == 0)
return false;
if (selectionService.SelectedItems.Count == 1 && selectionService.PrimarySelection == DesignContext.RootItem)
return false;
}
return true;
return true;
}
public void Copy()
{
XamlDesignContext xamlContext = _designContext as XamlDesignContext;
ISelectionService selectionService = GetService<ISelectionService>();
ISelectionService selectionService = GetService<ISelectionService>();
if(xamlContext != null && selectionService != null){
xamlContext.XamlEditAction.Copy(selectionService.SelectedItems);
}
@ -190,7 +221,7 @@ namespace ICSharpCode.WpfDesign.Designer @@ -190,7 +221,7 @@ namespace ICSharpCode.WpfDesign.Designer
public void Cut()
{
XamlDesignContext xamlContext = _designContext as XamlDesignContext;
ISelectionService selectionService = GetService<ISelectionService>();
ISelectionService selectionService = GetService<ISelectionService>();
if(xamlContext != null && selectionService != null){
xamlContext.XamlEditAction.Cut(selectionService.SelectedItems);
}

52
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml

@ -1,14 +1,38 @@ @@ -1,14 +1,38 @@
<UserControl x:Class="ICSharpCode.WpfDesign.Designer.DesignSurface"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Default="clr-namespace:ICSharpCode.WpfDesign.Designer"
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls"
DataContext="{x:Null}"
Background="#888">
<Controls:ZoomControl x:Name="uxZoom" AlwaysShowZoomButtons="True" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
<Default:DesignPanel x:Name="_designPanel">
<!-- Reset some inherited properties to the WPF defaults to avoid values from SharpDevelop applying to designed forms. -->
<Border x:Name="_sceneContainer" AllowDrop="False" UseLayoutRounding="False" TextOptions.TextFormattingMode="Ideal" />
</Default:DesignPanel>
</Controls:ZoomControl>
</UserControl>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Default="clr-namespace:ICSharpCode.WpfDesign.Designer"
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls"
xmlns:Designer="clr-namespace:ICSharpCode.WpfDesign.Designer"
xmlns:Widgets="http://icsharpcode.net/sharpdevelop/widgets">
<Style TargetType="{x:Type Designer:DesignSurface}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Designer:DesignSurface}">
<Controls:ZoomControl Background="#888" x:Name="PART_Zoom" MinimumZoom="0.025" AlwaysShowZoomButtons="True" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
<Controls:ZoomControl.AdditionalControls>
<StackPanel Orientation="Horizontal" Margin="0">
<Controls:EnumButton BorderThickness="0" DataContext="{Binding ElementName=PART_DesignContent}" Margin="0" Height="16" Width="16" IsChecked="{Binding ElementName=PART_DesignContent, Path=Content.UseRasterPlacement, Mode=TwoWay}" ToolTip="Use Raster Placement">
<Controls:EnumButton.ContextMenu>
<ContextMenu DataContext="{Binding PlacementTarget.DataContext,RelativeSource={RelativeSource Self}}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="RasterWidth:" />
<Widgets:NumericUpDown Width="40" Margin="5,0,0,0" Value="{Binding Path=Content.RasterWidth, Mode=TwoWay}"/>
</StackPanel>
</ContextMenu>
</Controls:EnumButton.ContextMenu>
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.GridSnap.png" Stretch="Uniform" />
</Controls:EnumButton>
<Controls:EnumButton BorderThickness="0" Margin="0" Height="16" Width="16" IsChecked="{Binding ElementName=PART_DesignContent, Path=Content.UseSnaplinePlacement, Mode=TwoWay}" ToolTip="Use Snapline Placement">
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.GuideSnap.png" Stretch="Uniform" />
</Controls:EnumButton>
</StackPanel>
</Controls:ZoomControl.AdditionalControls>
<ContentControl x:Name="PART_DesignContent" />
</Controls:ZoomControl>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

64
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/BorderForInvisibleControl.cs

@ -15,20 +15,68 @@ using System.Windows.Media; @@ -15,20 +15,68 @@ using System.Windows.Media;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
[ExtensionFor(typeof(Panel))]
[ExtensionFor(typeof(Border))]
[ExtensionFor(typeof(ContentControl))]
[ExtensionFor(typeof(Viewbox))]
public class BorderForInvisibleControl : PermanentAdornerProvider
{
AdornerPanel adornerPanel;
protected override void OnInitialized()
{
base.OnInitialized();
var adornerPanel = new AdornerPanel();
var border = new Border();
border.BorderThickness = new Thickness(1);
border.BorderBrush = new SolidColorBrush(Color.FromRgb(0xCC, 0xCC, 0xCC));
border.IsHitTestVisible = false;
AdornerPanel.SetPlacement(border, AdornerPlacement.FillContent);
adornerPanel.Children.Add(border);
Adorners.Add(adornerPanel);
if (ExtendedItem.Component is Border)
{
ExtendedItem.PropertyChanged+= (s, e) => ExtendedItem_PropertyChanged();
ExtendedItem_PropertyChanged();
}
else if (ExtendedItem.Component is Panel || ExtendedItem.Component is Viewbox || ExtendedItem.Component is ContentControl)
{
CreateAdorner();
}
}
void ExtendedItem_PropertyChanged()
{
if (ExtendedItem.Component is Border)
{
var border = ExtendedItem.Component as Border;
if (border.ReadLocalValue(Border.BorderBrushProperty) == DependencyProperty.UnsetValue || border.ReadLocalValue(Border.BorderThicknessProperty) == DependencyProperty.UnsetValue)
{
CreateAdorner();
}
else
{
RemoveAdorner();
}
}
}
private void CreateAdorner()
{
if (adornerPanel == null)
{
adornerPanel = new AdornerPanel();
adornerPanel.Order = AdornerOrder.Background;
var border = new Border();
border.BorderThickness = new Thickness(1);
border.BorderBrush = new SolidColorBrush(Color.FromRgb(0xCC, 0xCC, 0xCC));
border.IsHitTestVisible = false;
AdornerPanel.SetPlacement(border, AdornerPlacement.FillContent);
adornerPanel.Children.Add(border);
Adorners.Add(adornerPanel);
}
}
private void RemoveAdorner()
{
if (adornerPanel != null)
{
Adorners.Remove(adornerPanel);
adornerPanel = null;
}
}
}
}

56
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPlacementSupport.cs

@ -17,22 +17,20 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -17,22 +17,20 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
[ExtensionFor(typeof(Canvas), OverrideExtension=typeof(DefaultPlacementBehavior))]
public sealed class CanvasPlacementSupport : SnaplinePlacementBehavior
{
static double GetLeft(UIElement element)
GrayOutDesignerExceptActiveArea grayOut;
static double GetCanvasProperty(UIElement element, DependencyProperty d)
{
double v = (double)element.GetValue(Canvas.LeftProperty);
double v = (double)element.GetValue(d);
if (double.IsNaN(v))
return 0;
else
return v;
}
static double GetTop(UIElement element)
static bool IsPropertySet(UIElement element, DependencyProperty d)
{
double v = (double)element.GetValue(Canvas.TopProperty);
if (double.IsNaN(v))
return 0;
else
return v;
return element.ReadLocalValue(d) != DependencyProperty.UnsetValue;
}
public override void SetPosition(PlacementInformation info)
@ -43,16 +41,48 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -43,16 +41,48 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
UIElement child = info.Item.View;
Rect newPosition = info.Bounds;
if (newPosition.Left != GetLeft(child)) {
if (IsPropertySet(child, Canvas.RightProperty))
{
var newR = ((Canvas) ExtendedItem.Component).ActualWidth - newPosition.Right;
if (newR != GetCanvasProperty(child, Canvas.RightProperty))
info.Item.Properties.GetAttachedProperty(Canvas.RightProperty).SetValue(newR);
}
else if (newPosition.Left != GetCanvasProperty(child, Canvas.LeftProperty))
{
info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).SetValue(newPosition.Left);
}
if (newPosition.Top != GetTop(child)) {
if (IsPropertySet(child, Canvas.BottomProperty))
{
var newB = ((Canvas)ExtendedItem.Component).ActualHeight - newPosition.Bottom;
if (newB != GetCanvasProperty(child, Canvas.BottomProperty))
info.Item.Properties.GetAttachedProperty(Canvas.BottomProperty).SetValue(newB);
}
else if (newPosition.Top != GetCanvasProperty(child, Canvas.TopProperty))
{
info.Item.Properties.GetAttachedProperty(Canvas.TopProperty).SetValue(newPosition.Top);
}
if (info.Item == Services.Selection.PrimarySelection)
{
var cv = this.ExtendedItem.View as Canvas;
var b = new Rect(0, 0, cv.ActualWidth, cv.ActualHeight);
// only for primary selection:
if (grayOut != null)
{
grayOut.AnimateActiveAreaRectTo(b);
}
else
{
GrayOutDesignerExceptActiveArea.Start(ref grayOut, this.Services, this.ExtendedItem.View, b);
}
}
}
public override void LeaveContainer(PlacementOperation operation)
{
GrayOutDesignerExceptActiveArea.Stop(ref grayOut);
base.LeaveContainer(operation);
foreach (PlacementInformation info in operation.PlacedItems) {
info.Item.Properties.GetAttachedProperty(Canvas.LeftProperty).Reset();
@ -69,5 +99,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -69,5 +99,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
info.Item.Properties[FrameworkElement.MarginProperty].Reset();
}
}
public override void EndPlacement(PlacementOperation operation)
{
GrayOutDesignerExceptActiveArea.Stop(ref grayOut);
base.EndPlacement(operation);
}
}
}

77
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/CanvasPositionExtension.cs

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Windows.Input;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Controls;
using ICSharpCode.WpfDesign.Extensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
[ExtensionFor(typeof(FrameworkElement))]
[ExtensionServer(typeof(PrimarySelectionExtensionServer))]
public class CanvasPositionExtension : AdornerProvider
{
private MarginHandle[] _handles;
private MarginHandle _leftHandle, _topHandle, _rightHandle, _bottomHandle;
private Canvas _canvas;
protected override void OnInitialized()
{
base.OnInitialized();
if (this.ExtendedItem.Parent != null)
{
if (this.ExtendedItem.Parent.ComponentType == typeof(Canvas))
{
FrameworkElement extendedControl = (FrameworkElement)this.ExtendedItem.Component;
AdornerPanel adornerPanel = new AdornerPanel();
// If the Element is rotated/skewed in the grid, then margin handles do not appear
if (extendedControl.LayoutTransform.Value == Matrix.Identity && extendedControl.RenderTransform.Value == Matrix.Identity)
{
_canvas = this.ExtendedItem.Parent.View as Canvas;
_handles = new[]
{
_leftHandle = new CanvasPositionHandle(ExtendedItem, adornerPanel, HandleOrientation.Left),
_topHandle = new CanvasPositionHandle(ExtendedItem, adornerPanel, HandleOrientation.Top),
_rightHandle = new CanvasPositionHandle(ExtendedItem, adornerPanel, HandleOrientation.Right),
_bottomHandle = new CanvasPositionHandle(ExtendedItem, adornerPanel, HandleOrientation.Bottom),
};
}
if (adornerPanel != null)
this.Adorners.Add(adornerPanel);
}
}
}
public void HideHandles()
{
if (_handles != null)
{
foreach (var handle in _handles)
{
handle.ShouldBeVisible = false;
handle.Visibility = Visibility.Hidden;
}
}
}
public void ShowHandles()
{
if (_handles != null)
{
foreach (var handle in _handles)
{
handle.ShouldBeVisible = true;
handle.Visibility = Visibility.Visible;
handle.DecideVisiblity(handle.HandleLength);
}
}
}
}
}

41
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/DefaultPlacementBehavior.cs

@ -5,6 +5,7 @@ using System; @@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using ICSharpCode.WpfDesign.Extensions;
using System.Windows.Controls;
using System.Windows;
@ -18,6 +19,8 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -18,6 +19,8 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
{
[ExtensionFor(typeof(Panel))]
[ExtensionFor(typeof(ContentControl))]
[ExtensionFor(typeof(Border))]
[ExtensionFor(typeof(Viewbox))]
public class DefaultPlacementBehavior : BehaviorExtension, IPlacementBehavior
{
static List<Type> _contentControlsNotAllowedToAdd;
@ -30,7 +33,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -30,7 +33,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
_contentControlsNotAllowedToAdd.Add(typeof (HeaderedContentControl));
_contentControlsNotAllowedToAdd.Add(typeof (Label));
_contentControlsNotAllowedToAdd.Add(typeof (ListBoxItem));
_contentControlsNotAllowedToAdd.Add(typeof (ButtonBase));
//_contentControlsNotAllowedToAdd.Add(typeof (ButtonBase));
_contentControlsNotAllowedToAdd.Add(typeof (StatusBarItem));
_contentControlsNotAllowedToAdd.Add(typeof (ToolTip));
}
@ -61,6 +64,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -61,6 +64,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
public virtual void EndPlacement(PlacementOperation operation)
{
InfoTextEnterArea.Stop(ref infoTextEnterArea);
}
public virtual Rect GetPosition(PlacementOperation operation, DesignItem item)
@ -96,8 +100,41 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -96,8 +100,41 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
}
}
public virtual bool CanEnterContainer(PlacementOperation operation)
private static InfoTextEnterArea infoTextEnterArea;
public virtual bool CanEnterContainer(PlacementOperation operation, bool shouldAlwaysEnter)
{
var canEnter = internalCanEnterContainer(operation);
if (canEnter && !shouldAlwaysEnter && !Keyboard.IsKeyDown(Key.LeftAlt) && !Keyboard.IsKeyDown(Key.RightAlt))
{
var b = new Rect(0, 0, ((FrameworkElement)this.ExtendedItem.View).ActualWidth, ((FrameworkElement)this.ExtendedItem.View).ActualHeight);
InfoTextEnterArea.Start(ref infoTextEnterArea, this.Services, this.ExtendedItem.View, b, Translations.Instance.PressAltText);
return false;
}
return canEnter;
}
private bool internalCanEnterContainer(PlacementOperation operation)
{
InfoTextEnterArea.Stop(ref infoTextEnterArea);
if (ExtendedItem.Component is Expander)
{
if (!((Expander) ExtendedItem.Component).IsExpanded)
{
((Expander) ExtendedItem.Component).IsExpanded = true;
}
}
if (ExtendedItem.Component is UserControl && ExtendedItem.ComponentType != typeof(UserControl))
return false;
if (ExtendedItem.Component is Decorator)
return ((Decorator)ExtendedItem.Component).Child == null;
if (ExtendedItem.ContentProperty.IsCollection)
return CollectionSupport.CanCollectionAdd(ExtendedItem.ContentProperty.ReturnType,
operation.PlacedItems.Select(p => p.Item.Component));

48
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/Initializers.cs

@ -15,13 +15,55 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions.Initializers @@ -15,13 +15,55 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions.Initializers
{
public override void InitializeDefaults(DesignItem item)
{
DesignItemProperty contentProperty = item.Properties["Content"];
if (contentProperty.ValueOnInstance == null) {
contentProperty.SetValue(item.ComponentType.Name);
//Not every Content Control can have a text as Content (e.g. ZoomBox of WPF Toolkit)
if (item.Component is Button)
{
DesignItemProperty contentProperty = item.Properties["Content"];
if (contentProperty.ValueOnInstance == null)
{
contentProperty.SetValue(item.ComponentType.Name);
}
}
DesignItemProperty verticalAlignmentProperty = item.Properties["VerticalAlignment"];
if (verticalAlignmentProperty.ValueOnInstance == null)
{
verticalAlignmentProperty.SetValue(VerticalAlignment.Center);
}
DesignItemProperty horizontalAlignmentProperty = item.Properties["HorizontalAlignment"];
if (horizontalAlignmentProperty.ValueOnInstance == null)
{
horizontalAlignmentProperty.SetValue(HorizontalAlignment.Center);
}
}
}
[ExtensionFor(typeof(TextBlock))]
public class TextBlockInitializer : DefaultInitializer
{
public override void InitializeDefaults(DesignItem item)
{
DesignItemProperty textProperty = item.Properties["Text"];
if (textProperty.ValueOnInstance == null || textProperty.ValueOnInstance.ToString() == "")
{
textProperty.SetValue(item.ComponentType.Name);
}
DesignItemProperty verticalAlignmentProperty = item.Properties["VerticalAlignment"];
if (verticalAlignmentProperty.ValueOnInstance == null)
{
verticalAlignmentProperty.SetValue(VerticalAlignment.Center);
}
DesignItemProperty horizontalAlignmentProperty = item.Properties["HorizontalAlignment"];
if (horizontalAlignmentProperty.ValueOnInstance == null)
{
horizontalAlignmentProperty.SetValue(HorizontalAlignment.Center);
}
}
}
[ExtensionFor(typeof(HeaderedContentControl), OverrideExtension = typeof(ContentControlInitializer))]
public class HeaderedContentControlInitializer : DefaultInitializer
{

4
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/MarginHandleExtension.cs

@ -85,6 +85,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -85,6 +85,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
var leftMargin = position.Left - GetColumnOffset(column);
margin.Left = leftMargin;
this.ExtendedItem.Properties[FrameworkElement.HorizontalAlignmentProperty].Reset();
this.ExtendedItem.Properties[FrameworkElement.WidthProperty].Reset();
}
} else {
if (_leftHandle.Visibility == Visibility.Visible) {
@ -111,6 +112,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -111,6 +112,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
var topMargin = position.Top - GetRowOffset(row);
margin.Top = topMargin;
this.ExtendedItem.Properties[FrameworkElement.VerticalAlignmentProperty].Reset();
this.ExtendedItem.Properties[FrameworkElement.HeightProperty].Reset();
}
} else {
if (_topHandle.Visibility == Visibility.Visible) {
@ -137,6 +139,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -137,6 +139,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
var rightMargin = GetColumnOffset(column + columnSpan) - position.Right;
margin.Right = rightMargin;
this.ExtendedItem.Properties[FrameworkElement.HorizontalAlignmentProperty].Reset();
this.ExtendedItem.Properties[FrameworkElement.WidthProperty].Reset();
}
} else {
if (_rightHandle.Visibility == Visibility.Visible) {
@ -163,6 +166,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -163,6 +166,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
var bottomMargin = GetRowOffset(row + rowSpan) - position.Bottom;
margin.Bottom = bottomMargin;
this.ExtendedItem.Properties[FrameworkElement.VerticalAlignmentProperty].Reset();
this.ExtendedItem.Properties[FrameworkElement.HeightProperty].Reset();
}
} else {
if (_bottomHandle.Visibility == Visibility.Visible) {

26
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelInstanceFactory.cs

@ -64,6 +64,32 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -64,6 +64,32 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
}
}
[ExtensionFor(typeof(Border))]
public sealed class BorderInstanceFactory : CustomInstanceFactory
{
Brush _transparentBrush = new SolidColorBrush(Colors.Transparent);
/// <summary>
/// Creates an instance of the specified type, passing the specified arguments to its constructor.
/// </summary>
public override object CreateInstance(Type type, params object[] arguments)
{
object instance = base.CreateInstance(type, arguments);
Border panel = instance as Border;
if (panel != null)
{
if (panel.Background == null)
{
panel.Background = _transparentBrush;
}
TypeDescriptionProvider provider = new DummyValueInsteadOfNullTypeDescriptionProvider(
TypeDescriptor.GetProvider(panel), "Background", _transparentBrush);
TypeDescriptor.AddProvider(provider, panel);
}
return instance;
}
}
sealed class DummyValueInsteadOfNullTypeDescriptionProvider : TypeDescriptionProvider
{
// By using a TypeDescriptionProvider, we can intercept all access to the property that is

5
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelMove.cs

@ -14,6 +14,9 @@ using ICSharpCode.WpfDesign.Designer.Controls; @@ -14,6 +14,9 @@ using ICSharpCode.WpfDesign.Designer.Controls;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
[ExtensionFor(typeof(Panel))]
[ExtensionFor(typeof(Border))]
[ExtensionFor(typeof(ContentControl))]
[ExtensionFor(typeof(Viewbox))]
public class PanelMove : PermanentAdornerProvider
{
protected override void OnInitialized()
@ -24,7 +27,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -24,7 +27,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
var adorner = new PanelMoveAdorner(ExtendedItem);
AdornerPanel.SetPlacement(adorner, AdornerPlacement.FillContent);
adornerPanel.Children.Add(adorner);
Adorners.Add(adornerPanel);
Adorners.Add(adornerPanel);
}
}
}

21
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/QuickOperationMenuExtension.cs

@ -55,6 +55,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -55,6 +55,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
_menu.AddSubMenuInTheHeader(new MenuItem() {Header = "Edit Items"});
}
if(view is Grid) {
_menu.AddSubMenuInTheHeader(new MenuItem() {Header = "Edit Rows"});
_menu.AddSubMenuInTheHeader(new MenuItem() {Header = "Edit Columns"});
}
if (view is StackPanel) {
var ch = new MenuItem() {Header = "Change Orientation"};
_menu.AddSubMenuInTheHeader(ch);
@ -106,6 +111,22 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -106,6 +111,22 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
editor.Show();
}
if((string)clickedOn.Header=="Edit Rows") {
var editor = new FlatCollectionEditor();
var gd=this.ExtendedItem.View as Grid;
if (gd != null)
editor.LoadItemsCollection(this.ExtendedItem.Properties["RowDefinitions"]);
editor.Show();
}
if((string)clickedOn.Header=="Edit Columns") {
var editor = new FlatCollectionEditor();
var gd=this.ExtendedItem.View as Grid;
if (gd != null)
editor.LoadItemsCollection(this.ExtendedItem.Properties["ColumnDefinitions"]);
editor.Show();
}
if (parent.Header is string && (string) parent.Header == "Change Orientation") {
var value = _menu.UncheckChildrenAndSelectClicked(parent, clickedOn);
if (value != null) {

126
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/RasterPlacementBehavior.cs

@ -0,0 +1,126 @@ @@ -0,0 +1,126 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Controls;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
public class RasterPlacementBehavior : DefaultPlacementBehavior
{
Canvas surface;
AdornerPanel adornerPanel;
bool rasterDrawn = false;
int raster = 5;
public override void BeginPlacement(PlacementOperation operation)
{
base.BeginPlacement(operation);
DesignPanel designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel != null)
raster = designPanel.RasterWidth;
CreateSurface(operation);
}
public override void EndPlacement(PlacementOperation operation)
{
base.EndPlacement(operation);
DeleteSurface();
}
public override void EnterContainer(PlacementOperation operation)
{
base.EnterContainer(operation);
CreateSurface(operation);
}
public override void LeaveContainer(PlacementOperation operation)
{
base.LeaveContainer(operation);
DeleteSurface();
}
void CreateSurface(PlacementOperation operation)
{
if (ExtendedItem.Services.GetService<IDesignPanel>() != null)
{
surface = new Canvas();
adornerPanel = new AdornerPanel();
adornerPanel.SetAdornedElement(ExtendedItem.View, ExtendedItem);
AdornerPanel.SetPlacement(surface, AdornerPlacement.FillContent);
adornerPanel.Children.Add(surface);
ExtendedItem.Services.DesignPanel.Adorners.Add(adornerPanel);
}
}
void DeleteSurface()
{
rasterDrawn = false;
if (surface != null)
{
ExtendedItem.Services.DesignPanel.Adorners.Remove(adornerPanel);
adornerPanel = null;
surface = null;
}
}
public override void BeforeSetPosition(PlacementOperation operation)
{
base.BeforeSetPosition(operation);
if (surface == null) return;
DesignPanel designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel == null || !designPanel.UseRasterPlacement)
return;
if (Keyboard.IsKeyDown(Key.LeftCtrl))
{
surface.Children.Clear();
rasterDrawn = false;
return;
}
drawRaster();
var bounds = operation.PlacedItems[0].Bounds;
bounds.Y = ((int)bounds.Y/raster)*raster;
bounds.X = ((int)bounds.X/raster)*raster;
bounds.Width = Convert.ToInt32((bounds.Width/raster))*raster;
bounds.Height = Convert.ToInt32((bounds.Height/raster))*raster;
operation.PlacedItems[0].Bounds = bounds;
}
private void drawRaster()
{
if (!rasterDrawn)
{
rasterDrawn = true;
var w = ModelTools.GetWidth(ExtendedItem.View);
var h = ModelTools.GetHeight(ExtendedItem.View);
var dash = new DoubleCollection() {1, raster - 1};
for (int i = 0; i <= h; i += raster)
{
var line = new Line()
{
X1 = 0,
Y1 = i,
X2 = w,
Y2 = i,
StrokeThickness = 1,
Stroke = Brushes.Black,
StrokeDashArray = dash,
};
surface.Children.Add(line);
}
}
}
}
}

104
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/RenderTransformOriginExtension.cs

@ -0,0 +1,104 @@ @@ -0,0 +1,104 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Extensions;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows;
using System.Windows.Input;
using ICSharpCode.WpfDesign.Designer.Controls;
using System.Windows.Media;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
[ExtensionFor(typeof(FrameworkElement))]
public class RenderTransformOriginExtension : SelectionAdornerProvider
{
readonly AdornerPanel adornerPanel;
RenderTransformOriginThumb renderTransformOriginThumb;
/// <summary>An array containing this.ExtendedItem as only element</summary>
readonly DesignItem[] extendedItemArray = new DesignItem[1];
IPlacementBehavior resizeBehavior;
PlacementOperation operation;
ChangeGroup changeGroup;
public RenderTransformOriginExtension()
{
adornerPanel = new AdornerPanel();
adornerPanel.Order = AdornerOrder.Foreground;
this.Adorners.Add(adornerPanel);
CreateRenderTransformOriginThumb();
}
void CreateRenderTransformOriginThumb()
{
renderTransformOriginThumb = new RenderTransformOriginThumb();
renderTransformOriginThumb.Cursor = Cursors.Hand;
AdornerPanel.SetPlacement(renderTransformOriginThumb,
new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Top){XRelativeToContentWidth = renderTransformOrigin.X, YRelativeToContentHeight = renderTransformOrigin.Y});
adornerPanel.Children.Add(renderTransformOriginThumb);
renderTransformOriginThumb.DragDelta += new DragDeltaEventHandler(renderTransformOriginThumb_DragDelta);
}
void renderTransformOriginThumb_DragDelta(object sender, DragDeltaEventArgs e)
{
var p = AdornerPanel.GetPlacement(renderTransformOriginThumb) as RelativePlacement;
var pointAbs = adornerPanel.RelativeToAbsolute(new Vector(p.XRelativeToContentWidth, p.YRelativeToContentHeight));
var pointAbsNew = pointAbs + new Vector(e.HorizontalChange, e.VerticalChange);
var pRel = adornerPanel.AbsoluteToRelative(pointAbsNew);
this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).SetValue(new Point(Math.Round(pRel.X, 4), Math.Round(pRel.Y, 4)));
}
Point renderTransformOrigin = new Point(0.5, 0.5);
DependencyPropertyDescriptor renderTransformOriginPropertyDescriptor;
protected override void OnInitialized()
{
base.OnInitialized();
extendedItemArray[0] = this.ExtendedItem;
this.ExtendedItem.PropertyChanged += OnPropertyChanged;
if (this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).IsSet) {
renderTransformOrigin = (Point)this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).ValueOnInstance;
}
AdornerPanel.SetPlacement(renderTransformOriginThumb,
new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Top){XRelativeToContentWidth = renderTransformOrigin.X, YRelativeToContentHeight = renderTransformOrigin.Y});
renderTransformOriginPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(FrameworkElement.RenderTransformOriginProperty, typeof(FrameworkElement));
renderTransformOriginPropertyDescriptor.AddValueChanged(this.ExtendedItem.Component, OnRenderTransformOriginPropertyChanged);
}
private void OnRenderTransformOriginPropertyChanged(object sender, EventArgs e)
{
var pRel = renderTransformOrigin;
if (this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).IsSet)
pRel = (Point)this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).ValueOnInstance;
AdornerPanel.SetPlacement(renderTransformOriginThumb,
new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Top){ XRelativeToContentWidth = pRel.X, YRelativeToContentHeight = pRel.Y });
}
void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{ }
protected override void OnRemove()
{
renderTransformOriginPropertyDescriptor.RemoveValueChanged(this.ExtendedItem.Component, OnRenderTransformOriginPropertyChanged);
base.OnRemove();
}
}
}

163
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/ResizeThumbExtension.cs

@ -6,7 +6,7 @@ using System.Diagnostics; @@ -6,7 +6,7 @@ using System.Diagnostics;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Controls;
using ICSharpCode.WpfDesign.Extensions;
@ -26,8 +26,8 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -26,8 +26,8 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
readonly DesignItem[] extendedItemArray = new DesignItem[1];
IPlacementBehavior resizeBehavior;
PlacementOperation operation;
ChangeGroup changeGroup;
ChangeGroup changeGroup;
bool _isResizing;
/// <summary>
@ -78,41 +78,53 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -78,41 +78,53 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
/// <param name="alignment"></param>
/// <returns></returns>
private RelativePlacement Place(ref ResizeThumb resizeThumb,PlacementAlignment alignment)
{
RelativePlacement placement = new RelativePlacement(alignment.Horizontal,alignment.Vertical);
if (alignment.Horizontal == HorizontalAlignment.Center)
{
placement.WidthRelativeToContentWidth = 1;
placement.HeightOffset = 6;
resizeThumb.Opacity = 0;
return placement;
}
if (alignment.Vertical == VerticalAlignment.Center)
{
placement.HeightRelativeToContentHeight = 1;
placement.WidthOffset = 6;
resizeThumb.Opacity = 0;
return placement;
}
placement.WidthOffset = 6;
placement.HeightOffset = 6;
return placement;
}
{
RelativePlacement placement = new RelativePlacement(alignment.Horizontal,alignment.Vertical);
if (alignment.Horizontal == HorizontalAlignment.Center)
{
placement.WidthRelativeToContentWidth = 1;
placement.HeightOffset = 6;
resizeThumb.Opacity = 0;
return placement;
}
if (alignment.Vertical == VerticalAlignment.Center)
{
placement.HeightRelativeToContentHeight = 1;
placement.WidthOffset = 6;
resizeThumb.Opacity = 0;
return placement;
}
placement.WidthOffset = 6;
placement.HeightOffset = 6;
return placement;
}
Size oldSize;
ZoomControl zoom;
// TODO : Remove all hide/show extensions from here.
void drag_Started(DragListener drag)
{
var designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel != null)
{
var p = VisualTreeHelper.GetParent(designPanel);
while (p != null && !(p is ZoomControl))
{
p = VisualTreeHelper.GetParent(p);
}
zoom = p as ZoomControl;
}
/* Abort editing Text if it was editing, because it interferes with the undo stack. */
foreach(var extension in this.ExtendedItem.Extensions){
if(extension is InPlaceEditorExtension){
((InPlaceEditorExtension)extension).AbortEdit();
}
}
oldSize = new Size(ModelTools.GetWidth(ExtendedItem.View), ModelTools.GetHeight(ExtendedItem.View));
if (resizeBehavior != null)
operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
@ -134,11 +146,36 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -134,11 +146,36 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
if (alignment.Vertical == VerticalAlignment.Top) dy = -drag.Delta.Y;
if (alignment.Vertical == VerticalAlignment.Bottom) dy = drag.Delta.Y;
var designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (zoom != null)
{
dx = dx * (1 / zoom.CurrentZoom);
dy = dy * (1 / zoom.CurrentZoom);
}
var newWidth = Math.Max(0, oldSize.Width + dx);
var newHeight = Math.Max(0, oldSize.Height + dy);
ModelTools.Resize(ExtendedItem, newWidth, newHeight);
if (operation.CurrentContainerBehavior is GridPlacementSupport)
{
var hor = (HorizontalAlignment)this.ExtendedItem.Properties[FrameworkElement.HorizontalAlignmentProperty].ValueOnInstance;
var ver = (VerticalAlignment)this.ExtendedItem.Properties[FrameworkElement.VerticalAlignmentProperty].ValueOnInstance;
if (hor == HorizontalAlignment.Stretch)
this.ExtendedItem.Properties[FrameworkElement.WidthProperty].Reset();
else
this.ExtendedItem.Properties.GetProperty(FrameworkElement.WidthProperty).SetValue(newWidth);
if (ver == VerticalAlignment.Stretch)
this.ExtendedItem.Properties[FrameworkElement.HeightProperty].Reset();
else
this.ExtendedItem.Properties.GetProperty(FrameworkElement.HeightProperty).SetValue(newHeight);
}
else
{
ModelTools.Resize(ExtendedItem, newWidth, newHeight);
}
if (operation != null) {
var info = operation.PlacedItems[0];
var result = info.OriginalBounds;
@ -167,7 +204,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -167,7 +204,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
if (drag.IsCanceled) changeGroup.Abort();
else changeGroup.Commit();
changeGroup = null;
}
}
_isResizing=false;
HideSizeAndShowHandles();
}
@ -213,43 +250,43 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -213,43 +250,43 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
}
void ShowSizeAndHideHandles()
{
SizeDisplayExtension sizeDisplay=null;
MarginHandleExtension marginDisplay=null;
foreach(var extension in ExtendedItem.Extensions) {
if (extension is SizeDisplayExtension)
sizeDisplay = extension as SizeDisplayExtension;
if (extension is MarginHandleExtension)
marginDisplay = extension as MarginHandleExtension;
}
{
SizeDisplayExtension sizeDisplay=null;
MarginHandleExtension marginDisplay=null;
foreach(var extension in ExtendedItem.Extensions) {
if (extension is SizeDisplayExtension)
sizeDisplay = extension as SizeDisplayExtension;
if (extension is MarginHandleExtension)
marginDisplay = extension as MarginHandleExtension;
}
if(sizeDisplay!=null) {
sizeDisplay.HeightDisplay.Visibility = Visibility.Visible;
sizeDisplay.WidthDisplay.Visibility = Visibility.Visible;
}
if(marginDisplay!=null)
marginDisplay.HideHandles();
}
if(sizeDisplay!=null) {
sizeDisplay.HeightDisplay.Visibility = Visibility.Visible;
sizeDisplay.WidthDisplay.Visibility = Visibility.Visible;
}
if(marginDisplay!=null)
marginDisplay.HideHandles();
}
void HideSizeAndShowHandles()
{
SizeDisplayExtension sizeDisplay = null;
MarginHandleExtension marginDisplay=null;
foreach (var extension in ExtendedItem.Extensions){
if (extension is SizeDisplayExtension)
sizeDisplay = extension as SizeDisplayExtension;
if (extension is MarginHandleExtension)
marginDisplay = extension as MarginHandleExtension;
}
void HideSizeAndShowHandles()
{
SizeDisplayExtension sizeDisplay = null;
MarginHandleExtension marginDisplay=null;
foreach (var extension in ExtendedItem.Extensions){
if (extension is SizeDisplayExtension)
sizeDisplay = extension as SizeDisplayExtension;
if (extension is MarginHandleExtension)
marginDisplay = extension as MarginHandleExtension;
}
if (sizeDisplay != null) {
sizeDisplay.HeightDisplay.Visibility = Visibility.Hidden;
sizeDisplay.WidthDisplay.Visibility = Visibility.Hidden;
}
if (marginDisplay !=null ) {
marginDisplay.ShowHandles();
}
}
if (sizeDisplay != null) {
sizeDisplay.HeightDisplay.Visibility = Visibility.Hidden;
sizeDisplay.WidthDisplay.Visibility = Visibility.Hidden;
}
if (marginDisplay !=null ) {
marginDisplay.ShowHandles();
}
}
}
}

178
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/RotateThumbExtension.cs

@ -0,0 +1,178 @@ @@ -0,0 +1,178 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Controls;
using ICSharpCode.WpfDesign.Extensions;
using System.Collections.Generic;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
/// <summary>
/// The resize thumb around a component.
/// </summary>
[ExtensionFor(typeof(FrameworkElement))]
public sealed class RotateThumbExtension : SelectionAdornerProvider
{
readonly AdornerPanel adornerPanel;
readonly Thumb thumb;
/// <summary>An array containing this.ExtendedItem as only element</summary>
readonly DesignItem[] extendedItemArray = new DesignItem[1];
IPlacementBehavior resizeBehavior;
PlacementOperation operation;
ChangeGroup changeGroup;
bool _isResizing;
/// <summary>
/// Gets whether this extension is resizing any element.
/// </summary>
public bool IsResizing{
get { return _isResizing; }
}
public RotateThumbExtension()
{
adornerPanel = new AdornerPanel();
adornerPanel.Order = AdornerOrder.Foreground;
this.Adorners.Add(adornerPanel);
thumb = CreateRotateThumb();
}
ResizeThumb CreateRotateThumb()
{
ResizeThumb rotateThumb = new RotateThumb();
rotateThumb.Cursor = Cursors.Hand;
rotateThumb.Cursor = ZoomControl.GetCursor("Images/rotate.cur");
rotateThumb.Alignment = PlacementAlignment.Top;
AdornerPanel.SetPlacement(rotateThumb,
new RelativePlacement(HorizontalAlignment.Center, VerticalAlignment.Top) { WidthRelativeToContentWidth = 1, HeightOffset = 0 });
adornerPanel.Children.Add(rotateThumb);
DragListener drag = new DragListener(rotateThumb);
drag.Started += drag_Rotate_Started;
drag.Changed += drag_Rotate_Changed;
return rotateThumb;
}
Size oldSize;
#region Rotate
private Point centerPoint;
private UIElement parent;
private Vector startVector;
private RotateTransform rotateTransform;
private Point renderTransformOrigin;
private double initialAngle;
private DesignItem rtTransform;
private double angle;
private void drag_Rotate_Started(DragListener drag)
{
var designerItem = this.ExtendedItem.Component as FrameworkElement;
this.parent = VisualTreeHelper.GetParent(designerItem) as UIElement;
this.centerPoint = designerItem.TranslatePoint(
new Point(designerItem.ActualWidth*designerItem.RenderTransformOrigin.X,
designerItem.ActualHeight*designerItem.RenderTransformOrigin.Y),
this.parent);
Point startPoint = Mouse.GetPosition(this.parent);
this.startVector = Point.Subtract(startPoint, this.centerPoint);
if (this.rotateTransform == null)
{
this.initialAngle = 0;
}
else
{
this.initialAngle = this.rotateTransform.Angle;
}
rtTransform = this.ExtendedItem.Properties[FrameworkElement.RenderTransformProperty].Value;
operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
}
private void drag_Rotate_Changed(DragListener drag)
{
Point currentPoint = Mouse.GetPosition(this.parent);
Vector deltaVector = Point.Subtract(currentPoint, this.centerPoint);
double angle = Vector.AngleBetween(this.startVector, deltaVector);
var destAngle = this.initialAngle + Math.Round(angle, 0);
if (!Keyboard.IsKeyDown(Key.LeftCtrl))
destAngle = ((int)destAngle / 15) * 15;
if (destAngle == 0)
{
this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformProperty).Reset();
rtTransform = null;
rotateTransform = null;
}
else
{
if (rtTransform == null)
{
if (!this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).IsSet) {
this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).SetValue(new Point(0.5,0.5));
}
if (this.rotateTransform == null)
this.rotateTransform = new RotateTransform(0);
this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformProperty).SetValue(rotateTransform);
rtTransform = this.ExtendedItem.Properties[FrameworkElement.RenderTransformProperty].Value;
}
rtTransform.Properties["Angle"].SetValue(destAngle);
this.angle = destAngle * Math.PI / 180.0;
}
}
#endregion
protected override void OnInitialized()
{
if (this.ExtendedItem.Component is WindowClone)
return;
base.OnInitialized();
extendedItemArray[0] = this.ExtendedItem;
this.ExtendedItem.PropertyChanged += OnPropertyChanged;
this.Services.Selection.PrimarySelectionChanged += OnPrimarySelectionChanged;
resizeBehavior = PlacementOperation.GetPlacementBehavior(extendedItemArray);
OnPrimarySelectionChanged(null, null);
var designerItem = this.ExtendedItem.Component as FrameworkElement;
this.rotateTransform = designerItem.RenderTransform as RotateTransform;
if (rotateTransform != null)
angle = rotateTransform.Angle;
}
void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{ }
protected override void OnRemove()
{
this.ExtendedItem.PropertyChanged -= OnPropertyChanged;
this.Services.Selection.PrimarySelectionChanged -= OnPrimarySelectionChanged;
base.OnRemove();
}
void OnPrimarySelectionChanged(object sender, EventArgs e)
{
bool isPrimarySelection = this.Services.Selection.PrimarySelection == this.ExtendedItem;
foreach (RotateThumb g in adornerPanel.Children) {
g.IsPrimarySelection = isPrimarySelection;
}
}
}
}

12
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/SnaplinePlacementBehavior.cs

@ -19,7 +19,7 @@ using System.Windows.Input; @@ -19,7 +19,7 @@ using System.Windows.Input;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
public class SnaplinePlacementBehavior : DefaultPlacementBehavior
public class SnaplinePlacementBehavior : RasterPlacementBehavior
{
AdornerPanel adornerPanel;
Canvas surface;
@ -59,6 +59,10 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -59,6 +59,10 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
base.BeforeSetPosition(operation);
if (surface == null) return;
DesignPanel designPanel = ExtendedItem.Services.DesignPanel as DesignPanel;
if (designPanel == null || !designPanel.UseSnaplinePlacement)
return;
surface.Children.Clear();
if (Keyboard.IsKeyDown(Key.LeftCtrl)) return;
@ -167,6 +171,8 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -167,6 +171,8 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
var containerRect = new Rect(0, 0, ModelTools.GetWidth(ExtendedItem.View), ModelTools.GetHeight(ExtendedItem.View));
AddLines(containerRect, -Margin, false);
AddLines(containerRect, 0, false);
foreach (var item in ExtendedItem.ContentProperty.CollectionElements
.Except(operation.PlacedItems.Select(f => f.Item)))
{
@ -191,11 +197,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -191,11 +197,11 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
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, Start = r.Left, End = r.Right });
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, Start = r.Top, End = r.Bottom });
v.Add(new Snapline() { RequireOverlap = requireOverlap, Offset = r2.Right - 1, Start = r.Top, End = r.Bottom });
}
void AddBaseline(DesignItem item, Rect bounds, List<Snapline> list)

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/TopLeftContainerDragHandle.cs

@ -24,6 +24,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -24,6 +24,9 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
[ExtensionFor(typeof(Image))]
[ExtensionFor(typeof(MediaElement))]
[ExtensionFor(typeof(ItemsControl))]
[ExtensionFor(typeof(Border))]
[ExtensionFor(typeof(Viewbox))]
[ExtensionFor(typeof(ContentControl))]
public class TopLeftContainerDragHandle : AdornerProvider
{
/// <summary/>

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.GridSnap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.GuideSnap.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.Properties.Categorized.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.Properties.Events.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.Properties.Properties.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.Properties.SortAlphabet.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.WpfOutline.Eye.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/Icons.16x16.WpfOutline.EyeClose.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/group2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

17
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/license.txt

@ -4,4 +4,19 @@ License: Creative Commons Attribution 3.0 License @@ -4,4 +4,19 @@ License: Creative Commons Attribution 3.0 License
http://p.yusukekamiyamane.com/
Icons created by the SharpDevelop Team:
Class.png
Class.png
Copied from the Fugue Icon Library and left unmodified:
- Icons.16x16.Properties.Events.png
- Icons.16x16.Properties.SortAlphabet.png
- Icons.16x16.WpfOutline.Eye.png
- Icons.16x16.WpfOutline.EyeClosed.png
- Icons.16x16.GuideSnap.png
- Icons.16x16.GridSnap.png
Copied from the Fugue Icon Library and modified or mashed up with other Fugue
Icons or parts taken from them:
- Icons.16x16.Properties.Properties.png
- Icons.16x16.Properties.Categorized.png

BIN
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Images/rotate.cur

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

65
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/ModelTools.cs

@ -5,6 +5,13 @@ using System; @@ -5,6 +5,13 @@ using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.IO;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Xps.Serialization;
namespace ICSharpCode.WpfDesign.Designer
{
@ -86,6 +93,9 @@ namespace ICSharpCode.WpfDesign.Designer @@ -86,6 +93,9 @@ namespace ICSharpCode.WpfDesign.Designer
if (selectionService.SelectionCount == 0 && !items.Contains(parent)) {
selectionService.SetSelectedComponents(new DesignItem[] { parent });
}
foreach (var designItem in items) {
designItem.Name = null;
}
operation.DeleteItemsAndCommit();
} catch {
operation.Abort();
@ -93,15 +103,56 @@ namespace ICSharpCode.WpfDesign.Designer @@ -93,15 +103,56 @@ namespace ICSharpCode.WpfDesign.Designer
}
}
internal static void CreateVisualTree(this UIElement element)
{
try {
var fixedDoc = new FixedDocument();
var pageContent = new PageContent();
var fixedPage = new FixedPage();
fixedPage.Children.Add(element);
(pageContent as IAddChild).AddChild(fixedPage);
fixedDoc.Pages.Add(pageContent);
var f = new XpsSerializerFactory();
var w = f.CreateSerializerWriter(new MemoryStream());
w.Write(fixedDoc);
fixedPage.Children.Remove(element);
}
catch (Exception)
{ }
}
internal static Size GetDefaultSize(DesignItem createdItem)
{
var s = Metadata.GetDefaultSize(createdItem.ComponentType);
if (double.IsNaN(s.Width)) {
s.Width = GetWidth(createdItem.View);
}
if (double.IsNaN(s.Height)) {
s.Height = GetHeight(createdItem.View);
}
CreateVisualTree(createdItem.View);
var s = Metadata.GetDefaultSize(createdItem.ComponentType, false);
if (double.IsNaN(s.Width) && createdItem.View.DesiredSize.Width > 0)
{
s.Width = createdItem.View.DesiredSize.Width;
}
if (double.IsNaN(s.Height) && createdItem.View.DesiredSize.Height > 0)
{
s.Height = createdItem.View.DesiredSize.Width;
}
var newS = Metadata.GetDefaultSize(createdItem.ComponentType, true);
if (!(s.Width > 0))
s.Width = newS.Width;
if (!(s.Height > 0))
s.Height = newS.Height;
if (double.IsNaN(s.Width)) {
s.Width = GetWidth(createdItem.View);
}
if (double.IsNaN(s.Height)) {
s.Height = GetHeight(createdItem.View);
}
return s;
}

34
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml

@ -6,10 +6,40 @@ @@ -6,10 +6,40 @@
<UserControl.Resources>
<Style TargetType="ToggleButton" x:Key="eyeStyle">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid Background="Transparent" IsHitTestVisible="True">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CheckStates">
<VisualState x:Name="Checked">
<Storyboard>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="eye" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="closed_eye" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unchecked"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Image x:Name="eye" Stretch="None" Visibility="Hidden" Source="pack://application:,,,/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.WpfOutline.Eye.png" />
<Image x:Name="closed_eye" Stretch="None" Source="pack://application:,,,/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.WpfOutline.EyeClose.png" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<HierarchicalDataTemplate DataType="{x:Type Default:OutlineNode}"
ItemsSource="{Binding Children}">
<Default:IconItem Icon="../Images/Tag.png"
Text="{Binding Name}" />
<DockPanel>
<ToggleButton Style="{StaticResource eyeStyle}" DockPanel.Dock="Right" Width="20" Margin="0,0,5,0" IsChecked="{Binding IsDesignTimeVisible}" />
<Default:IconItem Icon="../Images/Tag.png" Text="{Binding Name}" />
</DockPanel>
</HierarchicalDataTemplate>
</UserControl.Resources>

33
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNode.cs

@ -11,6 +11,9 @@ using System.Collections.ObjectModel; @@ -11,6 +11,9 @@ using System.Collections.ObjectModel;
using System.Collections;
using ICSharpCode.WpfDesign.Designer;
using ICSharpCode.WpfDesign.XamlDom;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace ICSharpCode.WpfDesign.Designer.OutlineView
{
@ -41,6 +44,12 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -41,6 +44,12 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
DesignItem = designItem;
UpdateChildren();
var hidden = designItem.Properties.GetAttachedProperty(DesignTimeProperties.IsHiddenProperty).ValueOnInstance;
if (hidden != null && (bool) hidden == true) {
this._isDesignTimeVisible = false;
((FrameworkElement) this.DesignItem.Component).Visibility = Visibility.Hidden;
}
//TODO
DesignItem.NameChanged += new EventHandler(DesignItem_NameChanged);
DesignItem.PropertyChanged += new PropertyChangedEventHandler(DesignItem_PropertyChanged);
@ -80,6 +89,28 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -80,6 +89,28 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
}
}
}
bool _isDesignTimeVisible = true;
public bool IsDesignTimeVisible
{
get {
return _isDesignTimeVisible;
}
set {
_isDesignTimeVisible = value;
var ctl = DesignItem.Component as UIElement;
ctl.Visibility = _isDesignTimeVisible ? Visibility.Visible : Visibility.Hidden;
RaisePropertyChanged("IsDesignTimeVisible");
if (!value)
DesignItem.Properties.GetAttachedProperty(DesignTimeProperties.IsHiddenProperty).SetValue(true);
else
DesignItem.Properties.GetAttachedProperty(DesignTimeProperties.IsHiddenProperty).Reset();
}
}
ObservableCollection<OutlineNode> children = new ObservableCollection<OutlineNode>();
@ -147,7 +178,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -147,7 +178,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
return false;
var operation = PlacementOperation.Start(nodes.Select(node => node.DesignItem).ToArray(), DummyPlacementType);
if (operation != null) {
bool canEnter = placementBehavior.CanEnterContainer(operation);
bool canEnter = placementBehavior.CanEnterContainer(operation, true);
operation.Abort();
return canEnter;
}

20
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineView.xaml

@ -107,12 +107,30 @@ @@ -107,12 +107,30 @@
Margin="{TemplateBinding Level, Converter={StaticResource LevelConverter}}"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" />
<Border x:Name="contentBorder"
HorizontalAlignment="Left">
HorizontalAlignment="Stretch">
<ContentPresenter x:Name="PART_Header"
ContentSource="Header" />
</Border>
</DockPanel>
<ItemsPresenter x:Name="itemsHost" />
<DockPanel.ContextMenu>
<ContextMenu>
<MenuItem Command="ApplicationCommands.Cut" />
<MenuItem Command="ApplicationCommands.Copy" />
<MenuItem Command="ApplicationCommands.Paste" />
<Separator />
<MenuItem Command="ApplicationCommands.Delete" />
</ContextMenu>
</DockPanel.ContextMenu>
<DockPanel.ToolTip>
<ToolTip Background="White">
<Rectangle Width="50" Height="50">
<Rectangle.Fill>
<VisualBrush Stretch="Uniform" Visual="{Binding DesignItem.View}" />
</Rectangle.Fill>
</Rectangle>
</ToolTip>
</DockPanel.ToolTip>
</DockPanel>
<ControlTemplate.Triggers>

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/BrushEditor/GradientSlider.xaml.cs

@ -94,7 +94,8 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.BrushEditor @@ -94,7 +94,8 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.BrushEditor
if (e.Property == BrushProperty) {
if (Brush != null) {
GradientStops = new BindingList<GradientStop>(Brush.GradientStops);
SelectedStop = GradientStops.FirstOrDefault();
if (SelectedStop == null)
SelectedStop = GradientStops.FirstOrDefault();
}
else {
GradientStops = null;

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/CollectionEditor.xaml.cs

@ -26,6 +26,7 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors @@ -26,6 +26,7 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors
TypeMappings.Add(typeof(ListView),typeof(ListViewItem));
TypeMappings.Add(typeof(ComboBox),typeof(ComboBoxItem));
TypeMappings.Add(typeof(TreeView),typeof(TreeViewItem));
TypeMappings.Add(typeof(TabControl),typeof(TabItem));
}
private DesignItem _item;
@ -34,6 +35,8 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors @@ -34,6 +35,8 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors
public CollectionEditor()
{
InitializeComponent();
this.Owner = Application.Current.MainWindow;
}
public void LoadItemsCollection(DesignItem item)

85
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml

@ -0,0 +1,85 @@ @@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors.FlatCollectionEditor" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:OutlineView="clr-namespace:ICSharpCode.WpfDesign.Designer.OutlineView" xmlns:PropertyGrid="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid"
Height="438"
Width="750"
Title="Edit Items"
WindowStartupLocation="CenterScreen" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="3*" />
<ColumnDefinition
Width="100" />
<ColumnDefinition
Width="4*" />
</Grid.ColumnDefinitions>
<Border
BorderBrush="Black"
BorderThickness="0.75"
Margin="10"
SnapsToDevicePixels="True">
<ListBox
x:Name="ListBox"
SelectionChanged="ListBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock
Text="{Binding ComponentType.Name}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<Button
Content="Add"
Click="OnAddItemClicked"
Grid.Column="1"
Height="23"
HorizontalAlignment="Left"
Margin="0,12,0,0"
Name="AddItem"
VerticalAlignment="Top"
Width="75" />
<Button
Content="Remove"
Click="OnRemoveItemClicked"
Grid.Column="1"
Height="23"
HorizontalAlignment="Left"
Margin="0,42,0,0"
Name="RemoveItem"
VerticalAlignment="Top"
Width="75" />
<Button
Content="Move Up"
Click="OnMoveItemUpClicked"
Grid.Column="1"
Height="23"
HorizontalAlignment="Left"
Margin="0,72,0,0"
Name="MoveUpItem"
VerticalAlignment="Top"
Width="75" />
<Button
Content="Move Down"
Click="OnMoveItemDownClicked"
Grid.Column="1"
Height="23"
HorizontalAlignment="Left"
Margin="0,102,0,0"
Name="MoveDownItem"
VerticalAlignment="Top"
Width="75" />
<Border
BorderBrush="Black"
BorderThickness="0.75"
Margin="10"
Grid.Column="2"
SnapsToDevicePixels="True">
<PropertyGrid:PropertyGridView
x:Name="PropertyGridView"
Margin="0.5" />
</Border>
</Grid>
</Window>

111
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/Editors/FlatCollectionEditor.xaml.cs

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Linq;
using ICSharpCode.WpfDesign.Designer.OutlineView;
namespace ICSharpCode.WpfDesign.Designer.PropertyGrid.Editors
{
public partial class FlatCollectionEditor : Window
{
private static readonly Dictionary<Type, Type> TypeMappings = new Dictionary<Type, Type>();
static FlatCollectionEditor()
{
TypeMappings.Add(typeof(ListBox),typeof(ListBoxItem));
TypeMappings.Add(typeof(ListView),typeof(ListViewItem));
TypeMappings.Add(typeof(ComboBox),typeof(ComboBoxItem));
TypeMappings.Add(typeof(TabControl),typeof(TabItem));
TypeMappings.Add(typeof(ColumnDefinitionCollection),typeof(ColumnDefinition));
TypeMappings.Add(typeof(RowDefinitionCollection),typeof(RowDefinition));
}
private DesignItemProperty _itemProperty;
private IComponentService _componentService;
private Type _type;
public FlatCollectionEditor()
{
InitializeComponent();
this.Owner = Application.Current.MainWindow;
}
public void LoadItemsCollection(DesignItemProperty itemProperty)
{
_itemProperty = itemProperty;
_componentService=_itemProperty.DesignItem.Services.Component;
TypeMappings.TryGetValue(_itemProperty.ReturnType, out _type);
if (_type == null) {
PropertyGridView.IsEnabled=false;
ListBox.IsEnabled=false;
AddItem.IsEnabled=false;
RemoveItem.IsEnabled=false;
MoveUpItem.IsEnabled=false;
MoveDownItem.IsEnabled=false;
}
ListBox.ItemsSource = _itemProperty.CollectionElements;
}
private void OnAddItemClicked(object sender, RoutedEventArgs e)
{
DesignItem newItem = _componentService.RegisterComponentForDesigner(Activator.CreateInstance(_type));
_itemProperty.CollectionElements.Add(newItem);
}
private void OnRemoveItemClicked(object sender, RoutedEventArgs e)
{
var selItem = ListBox.SelectedItem as DesignItem;
if (selItem != null)
_itemProperty.CollectionElements.Remove(selItem);
}
private void OnMoveItemUpClicked(object sender, RoutedEventArgs e)
{
DesignItem selectedItem = ListBox.SelectedItem as DesignItem;
if (selectedItem!=null) {
if(_itemProperty.CollectionElements.Count!=1 && _itemProperty.CollectionElements.IndexOf(selectedItem)!=0){
int moveToIndex=_itemProperty.CollectionElements.IndexOf(selectedItem)-1;
var itemAtMoveToIndex=_itemProperty.CollectionElements[moveToIndex];
_itemProperty.CollectionElements.RemoveAt(moveToIndex);
if ((moveToIndex + 1) < (_itemProperty.CollectionElements.Count+1))
_itemProperty.CollectionElements.Insert(moveToIndex+1,itemAtMoveToIndex);
}
}
}
private void OnMoveItemDownClicked(object sender, RoutedEventArgs e)
{
DesignItem selectedItem = ListBox.SelectedItem as DesignItem;
if (selectedItem!=null) {
var itemCount=_itemProperty.CollectionElements.Count;
if(itemCount!=1 && _itemProperty.CollectionElements.IndexOf(selectedItem)!=itemCount){
int moveToIndex=_itemProperty.CollectionElements.IndexOf(selectedItem)+1;
if(moveToIndex<itemCount){
var itemAtMoveToIndex=_itemProperty.CollectionElements[moveToIndex];
_itemProperty.CollectionElements.RemoveAt(moveToIndex);
if(moveToIndex>0)
_itemProperty.CollectionElements.Insert(moveToIndex-1,itemAtMoveToIndex);
}
}
}
}
void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
PropertyGridView.PropertyGrid.SelectedItems = ListBox.SelectedItems.Cast<DesignItem>();
}
}
}

1
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyContextMenu.xaml

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
>
<MenuItem Header="Reset"
IsEnabled="{Binding IsSet}"
Click="Click_Reset" />
<MenuItem Header="Binding"
Click="Click_Binding" /><!--

624
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGrid.cs

@ -1,296 +1,328 @@ @@ -1,296 +1,328 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Threading;
using System.Globalization;
using ICSharpCode.WpfDesign.PropertyGrid;
using System.Windows.Threading;
using System.Diagnostics;
using System.Windows.Media;
using System.Windows;
namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
{
public class PropertyGrid : INotifyPropertyChanged
{
public PropertyGrid()
{
Categories = new ObservableCollection<Category>(new [] {
specialCategory,
popularCategory,
otherCategory,
attachedCategory
});
Events = new PropertyNodeCollection();
}
Category specialCategory = new Category("Special");
Category popularCategory = new Category("Popular");
Category otherCategory = new Category("Other");
Category attachedCategory = new Category("Attached");
Dictionary<MemberDescriptor, PropertyNode> nodeFromDescriptor = new Dictionary<MemberDescriptor, PropertyNode>();
public ObservableCollection<Category> Categories { get; private set; }
public PropertyNodeCollection Events { get; private set; }
PropertyGridTab currentTab;
public PropertyGridTab CurrentTab {
get {
return currentTab;
}
set {
currentTab = value;
RaisePropertyChanged("CurrentTab");
RaisePropertyChanged("NameBackground");
}
}
string filter;
public string Filter {
get {
return filter;
}
set {
filter = value;
Reload();
RaisePropertyChanged("Filter");
}
}
DesignItem singleItem;
public DesignItem SingleItem {
get {
return singleItem;
}
private set {
if (singleItem != null) {
singleItem.NameChanged -= singleItem_NameChanged;
}
singleItem = value;
if (singleItem != null) {
singleItem.NameChanged += singleItem_NameChanged;
}
RaisePropertyChanged("SingleItem");
RaisePropertyChanged("Name");
RaisePropertyChanged("IsNameEnabled");
IsNameCorrect = true;
}
}
void singleItem_NameChanged(object sender, EventArgs e)
{
RaisePropertyChanged("Name");
}
public string OldName {
get; private set;
}
public string Name {
get {
if (SingleItem != null) {
return SingleItem.Name;
}
return null;
}
set {
if (SingleItem != null) {
try {
if (string.IsNullOrEmpty(value)) {
OldName = null;
SingleItem.Properties["Name"].Reset();
} else {
OldName = SingleItem.Name;
SingleItem.Name = value;
}
IsNameCorrect = true;
} catch {
IsNameCorrect = false;
}
RaisePropertyChanged("Name");
}
}
}
bool isNameCorrect = true;
public bool IsNameCorrect {
get {
return isNameCorrect;
}
set {
isNameCorrect = value;
RaisePropertyChanged("IsNameCorrect");
}
}
public bool IsNameEnabled {
get {
return SingleItem != null;
}
}
IEnumerable<DesignItem> selectedItems;
public IEnumerable<DesignItem> SelectedItems {
get {
return selectedItems;
}
set {
selectedItems = value;
RaisePropertyChanged("SelectedItems");
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(
delegate {
Reload();
}));
}
}
public void ClearFilter()
{
Filter = null;
}
void Reload()
{
Clear();
if (SelectedItems == null || SelectedItems.Count() == 0) return;
if (SelectedItems.Count() == 1) SingleItem = SelectedItems.First();
foreach (var md in GetDescriptors()) {
if (PassesFilter(md.Name))
AddNode(md);
}
}
void Clear()
{
foreach (var c in Categories) {
c.IsVisible = false;
foreach (var p in c.Properties) {
p.IsVisible = false;
}
}
foreach (var e in Events) {
e.IsVisible = false;
}
SingleItem = null;
}
List<MemberDescriptor> GetDescriptors()
{
List<MemberDescriptor> list = new List<MemberDescriptor>();
if (SelectedItems.Count() == 1) {
foreach (MemberDescriptor d in TypeHelper.GetAvailableProperties(SingleItem.Component)) {
list.Add(d);
}
foreach (MemberDescriptor d in TypeHelper.GetAvailableEvents(SingleItem.ComponentType)) {
list.Add(d);
}
} else {
foreach (MemberDescriptor d in TypeHelper.GetCommonAvailableProperties(SelectedItems.Select(t => t.Component))) {
list.Add(d);
}
}
return list;
}
bool PassesFilter(string name)
{
if (string.IsNullOrEmpty(Filter)) return true;
for (int i = 0; i < name.Length; i++) {
if (i == 0 || char.IsUpper(name[i])) {
if (string.Compare(name, i, Filter, 0, Filter.Length, true) == 0) {
return true;
}
}
}
return false;
}
void AddNode(MemberDescriptor md)
{
var designProperties = SelectedItems.Select(item => item.Properties[md.Name]).ToArray();
if (!Metadata.IsBrowsable(designProperties[0])) return;
PropertyNode node;
if (nodeFromDescriptor.TryGetValue(md, out node)) {
node.Load(designProperties);
} else {
node = new PropertyNode();
node.Load(designProperties);
if (node.IsEvent) {
Events.AddSorted(node);
} else {
var cat = PickCategory(node);
cat.Properties.AddSorted(node);
node.Category = cat;
}
nodeFromDescriptor[md] = node;
}
node.IsVisible = true;
if (node.Category != null)
node.Category.IsVisible = true;
}
Category PickCategory(PropertyNode node)
{
if (Metadata.IsPopularProperty(node.FirstProperty)) return popularCategory;
if (node.FirstProperty.Name.Contains(".")) return attachedCategory;
var typeName = node.FirstProperty.DeclaringType.FullName;
if (typeName.StartsWith("System.Windows.") || typeName.StartsWith("ICSharpCode.WpfDesign.Designer.Controls."))
return otherCategory;
return specialCategory;
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
void RaisePropertyChanged(string name)
{
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
#endregion
//class CategoryNameComparer : IComparer<string>
//{
// public static CategoryNameComparer Instance = new CategoryNameComparer();
// public int Compare(string x, string y)
// {
// int i1 = Array.IndexOf(Metadata.CategoryOrder, x);
// if (i1 == -1) i1 = int.MaxValue;
// int i2 = Array.IndexOf(Metadata.CategoryOrder, y);
// if (i2 == -1) i2 = int.MaxValue;
// if (i1 == i2) return x.CompareTo(y);
// return i1.CompareTo(i2);
// }
//}
}
public enum PropertyGridTab
{
Properties,
Events
}
}
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Threading;
using System.Globalization;
using ICSharpCode.WpfDesign.PropertyGrid;
using System.Windows.Threading;
using System.Diagnostics;
using System.Windows.Media;
using System.Windows;
namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
{
public class PropertyGrid : INotifyPropertyChanged
{
public PropertyGrid()
{
Categories = new CategoriesCollection();
Categories.Add(specialCategory);
Categories.Add(popularCategory);
Categories.Add(otherCategory);
Categories.Add(attachedCategory);
Events = new PropertyNodeCollection();
}
Category specialCategory = new Category("Special");
Category popularCategory = new Category("Popular");
Category otherCategory = new Category("Other");
Category attachedCategory = new Category("Attached");
Dictionary<MemberDescriptor, PropertyNode> nodeFromDescriptor = new Dictionary<MemberDescriptor, PropertyNode>();
public CategoriesCollection Categories { get; private set; }
public PropertyNodeCollection Events { get; private set; }
private PropertyGridGroupMode _groupMode;
public PropertyGridGroupMode GroupMode
{
get { return _groupMode; }
set
{
if (_groupMode != value)
{
_groupMode = value;
RaisePropertyChanged("GroupMode");
Reload();
}
}
}
PropertyGridTab currentTab;
public PropertyGridTab CurrentTab {
get {
return currentTab;
}
set {
currentTab = value;
RaisePropertyChanged("CurrentTab");
RaisePropertyChanged("NameBackground");
}
}
string filter;
public string Filter {
get {
return filter;
}
set {
filter = value;
Reload();
RaisePropertyChanged("Filter");
}
}
DesignItem singleItem;
public DesignItem SingleItem {
get {
return singleItem;
}
private set {
if (singleItem != null) {
singleItem.NameChanged -= singleItem_NameChanged;
}
singleItem = value;
if (singleItem != null) {
singleItem.NameChanged += singleItem_NameChanged;
}
RaisePropertyChanged("SingleItem");
RaisePropertyChanged("Name");
RaisePropertyChanged("IsNameEnabled");
IsNameCorrect = true;
}
}
void singleItem_NameChanged(object sender, EventArgs e)
{
RaisePropertyChanged("Name");
}
public string OldName {
get; private set;
}
public string Name {
get {
if (SingleItem != null) {
return SingleItem.Name;
}
return null;
}
set {
if (SingleItem != null) {
try {
if (string.IsNullOrEmpty(value)) {
OldName = null;
SingleItem.Name = null;
} else {
OldName = SingleItem.Name;
SingleItem.Name = value;
}
IsNameCorrect = true;
} catch {
IsNameCorrect = false;
}
RaisePropertyChanged("Name");
}
}
}
bool isNameCorrect = true;
public bool IsNameCorrect {
get {
return isNameCorrect;
}
set {
isNameCorrect = value;
RaisePropertyChanged("IsNameCorrect");
}
}
public bool IsNameEnabled {
get {
return SingleItem != null;
}
}
IEnumerable<DesignItem> selectedItems;
public IEnumerable<DesignItem> SelectedItems {
get {
return selectedItems;
}
set {
selectedItems = value;
RaisePropertyChanged("SelectedItems");
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(
delegate {
Reload();
}));
}
}
public void ClearFilter()
{
Filter = null;
}
void Reload()
{
Clear();
if (SelectedItems == null || SelectedItems.Count() == 0) return;
if (SelectedItems.Count() == 1) SingleItem = SelectedItems.First();
foreach (var md in GetDescriptors()) {
if (PassesFilter(md.Name))
AddNode(md);
}
}
void Clear()
{
foreach (var c in Categories) {
c.IsVisible = false;
foreach (var p in c.Properties) {
p.IsVisible = false;
}
}
foreach (var e in Events) {
e.IsVisible = false;
}
SingleItem = null;
}
List<MemberDescriptor> GetDescriptors()
{
List<MemberDescriptor> list = new List<MemberDescriptor>();
if (SelectedItems.Count() == 1) {
foreach (MemberDescriptor d in TypeHelper.GetAvailableProperties(SingleItem.Component)) {
list.Add(d);
}
foreach (MemberDescriptor d in TypeHelper.GetAvailableEvents(SingleItem.ComponentType)) {
list.Add(d);
}
} else {
foreach (MemberDescriptor d in TypeHelper.GetCommonAvailableProperties(SelectedItems.Select(t => t.Component))) {
list.Add(d);
}
}
return list;
}
bool PassesFilter(string name)
{
if (string.IsNullOrEmpty(Filter)) return true;
for (int i = 0; i < name.Length; i++) {
if (i == 0 || char.IsUpper(name[i])) {
if (string.Compare(name, i, Filter, 0, Filter.Length, true) == 0) {
return true;
}
}
}
return false;
}
void AddNode(MemberDescriptor md)
{
var designProperties = SelectedItems.Select(item => item.Properties.GetProperty(md)).ToArray();
if (!Metadata.IsBrowsable(designProperties[0])) return;
PropertyNode node;
if (nodeFromDescriptor.TryGetValue(md, out node)) {
node.Load(designProperties);
} else {
node = new PropertyNode();
node.Load(designProperties);
if (node.IsEvent) {
Events.AddSorted(node);
} else {
var cat = PickCategory(node);
cat.Properties.AddSorted(node);
node.Category = cat;
}
nodeFromDescriptor[md] = node;
}
node.IsVisible = true;
if (node.Category != null)
node.Category.IsVisible = true;
}
Category PickCategory(PropertyNode node)
{
if (Metadata.IsPopularProperty(node.FirstProperty)) return popularCategory;
if (node.FirstProperty.IsAttachedDependencyProperty()) return attachedCategory;
var typeName = node.FirstProperty.DeclaringType.FullName;
if (typeName.StartsWith("System.Windows.") || typeName.StartsWith("ICSharpCode.WpfDesign.Designer.Controls."))
return otherCategory;
return specialCategory;
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
void RaisePropertyChanged(string name)
{
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
#endregion
//class CategoryNameComparer : IComparer<string>
//{
// public static CategoryNameComparer Instance = new CategoryNameComparer();
// public int Compare(string x, string y)
// {
// int i1 = Array.IndexOf(Metadata.CategoryOrder, x);
// if (i1 == -1) i1 = int.MaxValue;
// int i2 = Array.IndexOf(Metadata.CategoryOrder, y);
// if (i2 == -1) i2 = int.MaxValue;
// if (i1 == i2) return x.CompareTo(y);
// return i1.CompareTo(i2);
// }
//}
}
public class CategoriesCollection : SortedObservableCollection<Category, string>
{
public CategoriesCollection()
: base(n => n.Name)
{
}
}
public enum PropertyGridGroupMode
{
GroupByPopularCategorys,
GroupByCategorys,
Ungrouped,
}
public enum PropertyGridTab
{
Properties,
Events
}
}

26
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml.cs → src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.cs

@ -19,16 +19,29 @@ using ICSharpCode.WpfDesign.PropertyGrid; @@ -19,16 +19,29 @@ using ICSharpCode.WpfDesign.PropertyGrid;
namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
{
public partial class PropertyGridView
[TemplatePart(Name = "PART_Thumb", Type = typeof(Thumb))]
public class PropertyGridView : Control
{
static PropertyGridView()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PropertyGridView), new FrameworkPropertyMetadata(typeof(PropertyGridView)));
}
public PropertyGridView()
{
PropertyGrid = new PropertyGrid();
DataContext = PropertyGrid;
InitializeComponent();
}
private Thumb thumb;
public override void OnApplyTemplate()
{
thumb = GetTemplateChild("PART_Thumb") as Thumb;
thumb.DragDelta += new DragDeltaEventHandler(thumb_DragDelta);
base.OnApplyTemplate();
}
static PropertyContextMenu propertyContextMenu = new PropertyContextMenu();
@ -37,7 +50,7 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid @@ -37,7 +50,7 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
public static readonly DependencyProperty FirstColumnWidthProperty =
DependencyProperty.Register("FirstColumnWidth", typeof(double), typeof(PropertyGridView),
new PropertyMetadata(120.0));
new PropertyMetadata(120.0));
public double FirstColumnWidth {
get { return (double)GetValue(FirstColumnWidthProperty); }
@ -77,11 +90,6 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid @@ -77,11 +90,6 @@ namespace ICSharpCode.WpfDesign.Designer.PropertyGrid
contextMenu.IsOpen = true;
}
void clearButton_Click(object sender, RoutedEventArgs e)
{
PropertyGrid.ClearFilter();
}
void thumb_DragDelta(object sender, DragDeltaEventArgs e)
{
FirstColumnWidth = Math.Max(0, FirstColumnWidth + e.HorizontalChange);

578
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/PropertyGrid/PropertyGridView.xaml

@ -1,356 +1,236 @@ @@ -1,356 +1,236 @@
<UserControl x:Class="ICSharpCode.WpfDesign.Designer.PropertyGrid.PropertyGridView"
x:Name="root"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Converters="clr-namespace:ICSharpCode.WpfDesign.Designer.Converters"
xmlns:PropertyGrid="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid"
xmlns:PropertyGridBase="clr-namespace:ICSharpCode.WpfDesign.PropertyGrid;assembly=ICSharpCode.WpfDesign"
xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls"
Background="{x:Static SystemColors.ControlLightBrush}"
SnapsToDevicePixels="True">
<UserControl.Resources>
<Style x:Key="ExpandButtonStyle"
TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable"
Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Background="Transparent">
<Border Width="9"
Height="9"
SnapsToDevicePixels="true"
BorderBrush="#FF7898B5"
BorderThickness="1"
CornerRadius="1">
<Border.Background>
<LinearGradientBrush EndPoint="1,1"
StartPoint="0,0">
<GradientStop Color="White"
Offset=".2" />
<GradientStop Color="#FFC0B7A6"
Offset="1" />
</LinearGradientBrush>
</Border.Background>
<Path Margin="1,1,1,1"
x:Name="ExpandPath"
Fill="Black"
Data="M 0 2 L 0 3 L 2 3 L 2 5 L 3 5 L 3 3 L 5 3 L 5 2 L 3 2 L 3 0 L 2 0 L 2 2 Z" />
</Border>
<ResourceDictionary xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Converters="clr-namespace:ICSharpCode.WpfDesign.Designer.Converters" xmlns:PropertyGrid="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid" xmlns:PropertyGridBase="clr-namespace:ICSharpCode.WpfDesign.PropertyGrid;assembly=ICSharpCode.WpfDesign" xmlns:Controls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls" xmlns:propertyGrid="clr-namespace:ICSharpCode.WpfDesign.Designer.PropertyGrid">
<Style x:Key="ExpandButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Background="Transparent">
<Border Width="9" Height="9" SnapsToDevicePixels="true" BorderBrush="#FF7898B5" BorderThickness="1" CornerRadius="1">
<Border.Background>
<LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
<GradientStop Color="White" Offset=".2" />
<GradientStop Color="#FFC0B7A6" Offset="1" />
</LinearGradientBrush>
</Border.Background>
<Path Margin="1,1,1,1" x:Name="ExpandPath" Fill="Black" Data="M 0 2 L 0 3 L 2 3 L 2 5 L 3 5 L 3 3 L 5 3 L 5 2 L 3 2 L 3 0 L 2 0 L 2 2 Z" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked"
Value="True">
<Setter Property="Data"
TargetName="ExpandPath"
Value="M 0 2 L 0 3 L 5 3 L 5 2 Z" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MoreButtonStyle"
TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable"
Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Background="#F9F9F4"
BorderThickness="0 0 0 1"
BorderBrush="{x:Static SystemColors.ControlBrush}">
<!--<TextBlock Text="More..."
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Data" TargetName="ExpandPath" Value="M 0 2 L 0 3 L 5 3 L 5 2 Z" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MoreButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Background="#F9F9F4" BorderThickness="0 0 0 1" BorderBrush="{x:Static SystemColors.ControlBrush}">
<!--<TextBlock Text="More..."
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="18 0 0 0"
Foreground="{x:Static SystemColors.ControlDarkBrush}" />-->
<Path x:Name="arrow"
Data="M 0 0 L 5 5 L 10 0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="{x:Static SystemColors.ControlDarkBrush}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked"
Value="True">
<Setter TargetName="arrow"
Property="Data"
Value="M 0 5 L 5 0 L 10 5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CategoryToggleStyle"
TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable"
Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border BorderThickness="0 1 0 0"
BorderBrush="#ECE9D8">
<StackPanel Orientation="Horizontal"
Background="{x:Static SystemColors.ControlLightBrush}">
<ToggleButton Style="{StaticResource ExpandButtonStyle}"
IsChecked="{Binding IsExpanded}"
VerticalAlignment="Center"
Margin="3 0 7 0" />
<TextBlock Text="{Binding Name}"
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="{x:Static SystemColors.ControlDarkBrush}" />
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CategoryExpanderStyle"
TargetType="Expander">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<DockPanel>
<ToggleButton Height="17"
IsChecked="{Binding IsExpanded}"
DockPanel.Dock="Top"
Style="{StaticResource CategoryToggleStyle}" />
<ContentPresenter x:Name="ExpandSite"
Visibility="Collapsed" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded"
Value="True">
<Setter Property="Visibility"
Value="Visible"
TargetName="ExpandSite" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MoreExpanderStyle"
TargetType="Expander">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<DockPanel>
<ToggleButton IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource MoreButtonStyle}"
DockPanel.Dock="Top"
Height="12" />
<ContentPresenter x:Name="ExpandSite"
Visibility="Collapsed" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded"
Value="True">
<Setter Property="Visibility"
Value="Visible"
TargetName="ExpandSite" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate DataType="{x:Type PropertyGridBase:Category}">
<Expander Header="{Binding Name}"
Style="{StaticResource CategoryExpanderStyle}"
IsExpanded="{Binding IsExpanded}"
Visibility="{Binding IsVisible, Converter={x:Static Converters:CollapsedWhenFalse.Instance}}">
<ItemsControl ItemsSource="{Binding Properties}" />
<!--<StackPanel>
<ItemsControl ItemsSource="{Binding Properties}" />
<Expander Visibility="{Binding MoreProperties.Count, Converter={x:Static Converters:CollapsedWhenZero.Instance}}"
Style="{StaticResource MoreExpanderStyle}"
IsExpanded="{Binding ShowMore}">
<ItemsControl ItemsSource="{Binding MoreProperties}"
Background="#F9F9F4" />
</Expander>
</StackPanel>-->
</Expander>
</DataTemplate>
<DataTemplate DataType="{x:Type PropertyGridBase:PropertyNode}">
<StackPanel Visibility="{Binding IsVisible, Converter={x:Static Converters:CollapsedWhenFalse.Instance}}">
<Border x:Name="uxPropertyNodeRow"
MinHeight="20"
BorderThickness="0 0 0 1"
BorderBrush="{x:Static SystemColors.ControlBrush}"
DockPanel.Dock="Top">
<Path x:Name="arrow" Data="M 0 0 L 5 5 L 10 0" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{x:Static SystemColors.ControlDarkBrush}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="arrow" Property="Data" Value="M 0 5 L 5 0 L 10 5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CategoryToggleStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border BorderThickness="0 1 0 0" BorderBrush="#ECE9D8">
<StackPanel Orientation="Horizontal" Background="{x:Static SystemColors.ControlLightBrush}">
<ToggleButton Style="{StaticResource ExpandButtonStyle}" IsChecked="{Binding IsExpanded}" VerticalAlignment="Center" Margin="3 0 7 0" />
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" FontWeight="Bold" Foreground="{x:Static SystemColors.ControlDarkBrush}" />
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CategoryExpanderStyle" TargetType="Expander">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<DockPanel>
<DockPanel Width="{Binding FirstColumnWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type PropertyGrid:PropertyGridView}}}"
DockPanel.Dock="Left">
<ToggleButton x:Name="expandButton"
DockPanel.Dock="Left"
Margin="{Binding Level, Converter={x:Static Converters:LevelConverter.Instance}}"
Style="{StaticResource ExpandButtonStyle}"
IsChecked="{Binding IsExpanded}"
Visibility="{Binding HasChildren, Converter={x:Static Converters:HiddenWhenFalse.Instance}}" />
<TextBlock Text="{Binding Name}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"
Margin="7 0 0 0"
ToolTip="{Binding Description}"
FontWeight="{Binding IsSet, Converter={x:Static Converters:BoldWhenTrue.Instance}}"
Foreground="{Binding NameForeground}" />
</DockPanel>
<Border BorderThickness="1 0 0 0"
BorderBrush="{x:Static SystemColors.ControlBrush}">
<ContentPresenter x:Name="editorContainer"
Content="{Binding Editor}"
VerticalAlignment="Center"
Margin="3 0" />
</Border>
<ToggleButton Height="17" IsChecked="{Binding IsExpanded}" DockPanel.Dock="Top" Style="{StaticResource CategoryToggleStyle}" />
<ContentPresenter x:Name="ExpandSite" Visibility="Collapsed" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter Property="Visibility" Value="Visible" TargetName="ExpandSite" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MoreExpanderStyle" TargetType="Expander">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<DockPanel>
<ToggleButton IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource MoreButtonStyle}" DockPanel.Dock="Top" Height="12" />
<ContentPresenter x:Name="ExpandSite" Visibility="Collapsed" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter Property="Visibility" Value="Visible" TargetName="ExpandSite" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SelectedImageButton" TargetType="{x:Type RadioButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="BorderBrush" Value="Transparent" />
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="BorderBrush" Value="Blue" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="BorderBrush" Value="DeepSkyBlue" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type PropertyGrid:PropertyGridView}">
<Setter Property="Background" Value="{x:Static SystemColors.ControlLightBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PropertyGrid:PropertyGridView}">
<DockPanel LastChildFill="True" Background="{TemplateBinding Background}">
<DockPanel.Resources>
<DataTemplate DataType="{x:Type PropertyGridBase:Category}">
<Expander Header="{Binding Name}" Style="{StaticResource CategoryExpanderStyle}" IsExpanded="{Binding IsExpanded}" Visibility="{Binding IsVisible, Converter={x:Static Converters:CollapsedWhenFalse.Instance}}">
<ItemsControl ItemsSource="{Binding Properties}" />
</Expander>
</DataTemplate>
<DataTemplate DataType="{x:Type PropertyGridBase:PropertyNode}">
<StackPanel Visibility="{Binding IsVisible, Converter={x:Static Converters:CollapsedWhenFalse.Instance}}">
<Border x:Name="uxPropertyNodeRow" MinHeight="20" BorderThickness="0 0 0 1" BorderBrush="{x:Static SystemColors.ControlBrush}" DockPanel.Dock="Top">
<DockPanel>
<DockPanel Width="{Binding FirstColumnWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type PropertyGrid:PropertyGridView}}}" DockPanel.Dock="Left">
<ToggleButton x:Name="expandButton" DockPanel.Dock="Left" Margin="{Binding Level, Converter={x:Static Converters:LevelConverter.Instance}}" Style="{StaticResource ExpandButtonStyle}" IsChecked="{Binding IsExpanded}" Visibility="{Binding HasChildren, Converter={x:Static Converters:HiddenWhenFalse.Instance}}" />
<Rectangle Width="8" Height="8" Stroke="Black" Fill="{Binding IsSet, Converter={x:Static Converters:BlackWhenTrue.Instance}}" StrokeThickness="1" DockPanel.Dock="Right" Margin="4,0,4,0" VerticalAlignment="Center" />
<TextBlock Text="{Binding Name}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" Margin="7 0 0 0" ToolTip="{Binding Description}" FontWeight="{Binding IsSet, Converter={x:Static Converters:BoldWhenTrue.Instance}}" Foreground="{Binding NameForeground}" />
</DockPanel>
<Border BorderThickness="1 0 0 0" BorderBrush="{x:Static SystemColors.ControlBrush}">
<ContentPresenter x:Name="editorContainer" Content="{Binding Editor}" VerticalAlignment="Center" Margin="3 0" />
</Border>
</DockPanel>
</Border>
<StackPanel Visibility="{Binding IsExpanded, Converter={x:Static Converters:CollapsedWhenFalse.Instance}}">
<ItemsControl ItemsSource="{Binding Children}" Visibility="{Binding Children.Count, Converter={x:Static Converters:CollapsedWhenZero.Instance}}" />
<Expander Visibility="{Binding MoreChildren.Count, Converter={x:Static Converters:CollapsedWhenZero.Instance}}" Style="{StaticResource MoreExpanderStyle}">
<ItemsControl ItemsSource="{Binding MoreChildren}" Background="#F9F9F4" />
</Expander>
</StackPanel>
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsEnabled}" Value="False">
<Setter TargetName="editorContainer" Property="Opacity" Value="0.5" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
<DataTemplate DataType="{x:Type FontFamily}">
<TextBlock Text="{Binding}" Height="15" FontFamily="{Binding}" FontSize="12" />
</DataTemplate>
</DockPanel.Resources>
<Grid DockPanel.Dock="Top" Height="78">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Background="White" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Width="44" Height="44" HorizontalAlignment="Left" Padding="2" Margin="6,0,0,0">
<Rectangle>
<Rectangle.Fill>
<VisualBrush Stretch="Uniform" Visual="{Binding SingleItem.Component}" />
</Rectangle.Fill>
</Rectangle>
</Border>
<TextBlock Grid.Column="1" Text="Name:" Margin="6,30,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
<TextBlock Grid.Column="1" Text="Type:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6,8,0,0" />
<TextBlock Grid.Column="1" Text="Filter:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6,54,0,0" />
<Controls:EnterTextBox Grid.Column="1" x:Name="NameTextBox" Text="{Binding Name}" IsEnabled="{Binding IsNameEnabled}" Margin="44,28,6,0" Height="19.277" VerticalAlignment="Top">
<Controls:EnterTextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsNameCorrect}" Value="False">
<Setter Property="BorderBrush" Value="Red" />
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsNameEnabled}" Value="True" />
<Condition Binding="{Binding CurrentTab}" Value="Events" />
<Condition Binding="{Binding Text, RelativeSource={RelativeSource Self}}" Value="" />
</MultiDataTrigger.Conditions>
<Setter Property="BorderBrush" Value="Red" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Controls:EnterTextBox.Style>
</Controls:EnterTextBox>
<TextBlock Grid.Column="1" Text="{Binding SingleItem.ComponentType.Name}" ToolTip="{Binding SingleItem.ComponentType}" Margin="44,8,6,0" Height="13.277" VerticalAlignment="Top" />
<Controls:ClearableTextBox Grid.Column="1" Text="{Binding Filter, UpdateSourceTrigger=PropertyChanged}" Margin="44,52,6,0" VerticalAlignment="Top" Height="19" />
</Grid>
<Grid DockPanel.Dock="Top" Height="30">
<StackPanel Orientation="Horizontal">
<StackPanel Margin="3" HorizontalAlignment="Left" Orientation="Horizontal">
<RadioButton Style="{StaticResource SelectedImageButton}" GroupName="SortMode" IsChecked="{Binding GroupMode, Converter={x:Static Converters:EnumBoolean.Instance}, ConverterParameter=GroupByPopularCategorys}" Margin="3,0,0,0" Width="20" Height="20">
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.Properties.Categorized.png" Stretch="None" />
</RadioButton>
<!--<RadioButton Style="{StaticResource SelectedImageButton}" GroupName="SortMode" IsChecked="{Binding GroupMode, Converter={x:Static Converters:EnumBoolean.Instance}, ConverterParameter=GroupByCategorys}" Margin="3,0,0,0" Width="20" Height="20">
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/group2.png" Stretch="None" />
</RadioButton>
<RadioButton Style="{StaticResource SelectedImageButton}" GroupName="SortMode" IsChecked="{Binding GroupMode, Converter={x:Static Converters:EnumBoolean.Instance}, ConverterParameter=Ungrouped}" Margin="3,0,0,0" Width="20" Height="20">
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.Properties.SortAlphabet.png" Stretch="None" />
</RadioButton>-->
</StackPanel>
<StackPanel Margin="3" HorizontalAlignment="Left" Orientation="Horizontal" Visibility="{Binding ShowPropertiesEventsSelector, Converter={x:Static Converters:CollapsedWhenFalse.Instance}, ElementName=root}">
<RadioButton Style="{StaticResource SelectedImageButton}" GroupName="ShowType" IsChecked="{Binding CurrentTab, Converter={x:Static Converters:EnumBoolean.Instance}, ConverterParameter=Properties}" Margin="3,0,0,0" Width="20" Height="20">
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.Properties.Properties.png" Stretch="None" />
</RadioButton>
<RadioButton Style="{StaticResource SelectedImageButton}" GroupName="ShowType" IsChecked="{Binding CurrentTab, Converter={x:Static Converters:EnumBoolean.Instance}, ConverterParameter=Events}" Margin="3,0,0,0" Width="20" Height="20">
<Image Source="/ICSharpCode.WpfDesign.Designer;component/Images/Icons.16x16.Properties.Events.png" Stretch="None" />
</RadioButton>
</StackPanel>
</StackPanel>
</Grid>
<Grid x:Name="c1" Background="White">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" Visibility="{Binding CurrentTab, Converter={x:Static Converters:EnumVisibility.Instance}, ConverterParameter=Properties}">
<ItemsControl ItemsSource="{Binding Categories}" />
</ScrollViewer>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" Visibility="{Binding CurrentTab, Converter={x:Static Converters:EnumVisibility.Instance}, ConverterParameter=Events}">
<ItemsControl ItemsSource="{Binding Events}" />
</ScrollViewer>
<Thumb x:Name="PART_Thumb" HorizontalAlignment="Left" Width="4" Margin="-2 0 0 0" Cursor="SizeWE">
<Thumb.RenderTransform>
<TranslateTransform X="{Binding FirstColumnWidth, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
</Thumb.RenderTransform>
<Thumb.Template>
<ControlTemplate>
<Border Background="Transparent" />
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Grid>
</DockPanel>
</Border>
<StackPanel Visibility="{Binding IsExpanded, Converter={x:Static Converters:CollapsedWhenFalse.Instance}}">
<ItemsControl ItemsSource="{Binding Children}"
Visibility="{Binding Children.Count, Converter={x:Static Converters:CollapsedWhenZero.Instance}}" />
<Expander Visibility="{Binding MoreChildren.Count, Converter={x:Static Converters:CollapsedWhenZero.Instance}}"
Style="{StaticResource MoreExpanderStyle}">
<ItemsControl ItemsSource="{Binding MoreChildren}"
Background="#F9F9F4" />
</Expander>
</StackPanel>
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsEnabled}"
Value="False">
<Setter TargetName="editorContainer"
Property="Opacity"
Value="0.5" />
<Setter TargetName="editorContainer"
Property="IsHitTestVisible"
Value="False" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
<!--<DataTemplate DataType="{x:Type FontFamily}">
<TextBlock Text="{Binding}"
FontFamily="{Binding}"
FontSize="16"/>
</DataTemplate>-->
</UserControl.Resources>
<DockPanel>
<Grid DockPanel.Dock="Top"
Height="78">
<TextBlock Text="Name:"
Margin="6,30.275,0,33.948"
HorizontalAlignment="Left"
Width="32.033" />
<TextBlock Text="Type:"
VerticalAlignment="Top"
Margin="6.424,7.998,0,0"
Height="13.277" />
<TextBlock Text="Filter:"
HorizontalAlignment="Left"
Margin="6,53.553,0,0"
VerticalAlignment="Top" />
<Controls:EnterTextBox x:Name="NameTextBox"
x:FieldModifier="public"
Text="{Binding Name}"
IsEnabled="{Binding IsNameEnabled}"
Margin="44.033,27.275,6,0"
Height="19.277"
VerticalAlignment="Top">
<Control.Style>
<Style TargetType="TextBox">
<Style.Triggers>
<DataTrigger Binding="{Binding IsNameCorrect}"
Value="False">
<Setter Property="BorderBrush"
Value="Red" />
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsNameEnabled}"
Value="True" />
<Condition Binding="{Binding CurrentTab}"
Value="Events" />
<Condition Binding="{Binding Text, RelativeSource={RelativeSource Self}}"
Value="" />
</MultiDataTrigger.Conditions>
<Setter Property="BorderBrush"
Value="Red" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Control.Style>
</Controls:EnterTextBox>
<TextBlock Text="{Binding SingleItem.ComponentType.Name}"
ToolTip="{Binding SingleItem.ComponentType}"
Margin="44.033,7.998,6,0"
Height="13.277"
VerticalAlignment="Top" />
<Controls:EnterTextBox Text="{Binding Filter, UpdateSourceTrigger=PropertyChanged}"
Margin="44.033,50.553,52,0"
VerticalAlignment="Top"
Height="19.277" />
<Button x:Name="clearButton"
Content="Clear"
Click="clearButton_Click"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="0,49.552,6,0"
Height="21.277"
Width="40" />
</Grid>
<Controls:EnumBar Value="{Binding CurrentTab}"
Container="{Binding ElementName=c1}"
Margin="5 0 0 5"
DockPanel.Dock="Top">
<Controls:EnumBar.ButtonStyle>
<Style TargetType="ToggleButton">
<Setter Property="Width"
Value="70" />
</Style>
</Controls:EnumBar.ButtonStyle>
</Controls:EnumBar>
<Grid x:Name="c1"
Background="White">
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<ItemsControl ItemsSource="{Binding Categories}" />
</ScrollViewer>
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<ItemsControl ItemsSource="{Binding Events}" />
</ScrollViewer>
<Thumb x:Name="thumb"
HorizontalAlignment="Left"
Width="4"
Margin="-2 0 0 0"
Cursor="SizeWE">
<Thumb.RenderTransform>
<TranslateTransform X="{Binding FirstColumnWidth, ElementName=root}" />
</Thumb.RenderTransform>
<Thumb.Template>
<ControlTemplate>
<Border Background="Transparent" />
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Grid>
</DockPanel>
</UserControl>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save