@ -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; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -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(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
// 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.Gui; |
||||
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() |
||||
{ |
||||
WorkbenchSingleton.Workbench.ActiveViewContentChanged += WorkbenchActiveViewContentChanged; |
||||
WorkbenchActiveViewContentChanged(null, null); |
||||
} |
||||
|
||||
void WorkbenchActiveViewContentChanged(object sender, EventArgs e) |
||||
{ |
||||
WpfViewContent wpfView = WorkbenchSingleton.Workbench.ActiveViewContent as WpfViewContent; |
||||
if (wpfView != null) |
||||
{ |
||||
thumbnailView.DesignSurface = wpfView.DesignSurface; |
||||
contentControl.SetContent(thumbnailView); |
||||
} |
||||
else |
||||
{ |
||||
|
||||
contentControl.SetContent(notAvailableTextBlock); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
|
||||
/// </summary>
|
||||
public override object Control { |
||||
get { |
||||
return contentControl; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,160 +1,158 @@
@@ -1,160 +1,158 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.WpfDesign.AddIn</RootNamespace> |
||||
<AssemblyName>ICSharpCode.WpfDesign.AddIn</AssemblyName> |
||||
<OutputPath>..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\</OutputPath> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<TargetFrameworkProfile> |
||||
</TargetFrameworkProfile> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<Optimize>False</Optimize> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="PresentationCore" /> |
||||
<Reference Include="PresentationFramework" /> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xaml"> |
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="WindowsBase" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons.32x32.Error.png" /> |
||||
<None Include="WpfDesign.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>Configuration\GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Src\AbstractEventHandlerService.cs" /> |
||||
<Compile Include="Src\Commands\CutCopyPaste.cs" /> |
||||
<Compile Include="Src\Commands\Pads.cs" /> |
||||
<Compile Include="Src\Commands\Remove.cs" /> |
||||
<Compile Include="Src\Commands\UndoRedo.cs" /> |
||||
<Compile Include="Src\Commands\ViewXaml.cs" /> |
||||
<Compile Include="Src\CSharpEventHandlerService.cs" /> |
||||
<Compile Include="Src\FileUriContext.cs" /> |
||||
<Compile Include="Src\IdeChooseClassService.cs" /> |
||||
<Compile Include="Src\ImageSourceEditor\ChooseImageDialog.xaml.cs"> |
||||
<DependentUpon>ChooseImageDialog.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\ImageSourceEditor\ImageSourceEditor.xaml.cs"> |
||||
<DependentUpon>ImageSourceEditor.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\MyTypeFinder.cs" /> |
||||
<Compile Include="Src\ObjectEditor.xaml.cs"> |
||||
<DependentUpon>ObjectEditor.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\OutlineViewPad.cs" /> |
||||
<Compile Include="Src\ProjectTools.cs" /> |
||||
<Compile Include="Src\PropertyDescriptionService.cs" /> |
||||
<Compile Include="Src\WpfAndWinFormsTopLevelWindowService.cs" /> |
||||
<Compile Include="Src\WpfDisplayBinding.cs" /> |
||||
<Compile Include="Src\WpfDocumentError.xaml.cs"> |
||||
<DependentUpon>WpfDocumentError.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\WpfSideTabItem.cs" /> |
||||
<Compile Include="Src\WpfToolbox.cs" /> |
||||
<Compile Include="Src\WpfViewContent.cs" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="Src\WpfDocumentError.xaml" /> |
||||
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj"> |
||||
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project> |
||||
<Name>ICSharpCode.Core.Presentation</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj"> |
||||
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project> |
||||
<Name>ICSharpCode.Core.WinForms</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj"> |
||||
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project> |
||||
<Name>ICSharpCode.SharpDevelop.Dom</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj"> |
||||
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project> |
||||
<Name>ICSharpCode.SharpDevelop.Widgets</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\FormsDesigner\Project\FormsDesigner.csproj"> |
||||
<Project>{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}</Project> |
||||
<Name>FormsDesigner</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\WpfDesign.Designer\Project\WpfDesign.Designer.csproj"> |
||||
<Project>{78CC29AC-CC79-4355-B1F2-97936DF198AC}</Project> |
||||
<Name>WpfDesign.Designer</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj"> |
||||
<Project>{88DA149F-21B2-48AB-82C4-28FB6BDFD783}</Project> |
||||
<Name>WpfDesign.XamlDom</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\WpfDesign\Project\WpfDesign.csproj"> |
||||
<Project>{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}</Project> |
||||
<Name>WpfDesign</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<Page Include="Src\ImageSourceEditor\ChooseImageDialog.xaml" /> |
||||
<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> |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.WpfDesign.AddIn</RootNamespace> |
||||
<AssemblyName>ICSharpCode.WpfDesign.AddIn</AssemblyName> |
||||
<OutputPath>..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\</OutputPath> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<TargetFrameworkProfile> |
||||
</TargetFrameworkProfile> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<Optimize>False</Optimize> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="PresentationCore" /> |
||||
<Reference Include="PresentationFramework" /> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xaml"> |
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="WindowsBase" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Images\Icons.32x32.Error.png" /> |
||||
<None Include="WpfDesign.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>Configuration\GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Src\AbstractEventHandlerService.cs" /> |
||||
<Compile Include="Src\Commands\CutCopyPaste.cs" /> |
||||
<Compile Include="Src\Commands\Pads.cs" /> |
||||
<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\CSharpEventHandlerService.cs" /> |
||||
<Compile Include="Src\FileUriContext.cs" /> |
||||
<Compile Include="Src\IdeChooseClassService.cs" /> |
||||
<Compile Include="Src\ImageSourceEditor\ChooseImageDialog.xaml.cs"> |
||||
<DependentUpon>ChooseImageDialog.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\ImageSourceEditor\ImageSourceEditor.xaml.cs"> |
||||
<DependentUpon>ImageSourceEditor.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\MyTypeFinder.cs" /> |
||||
<Compile Include="Src\ObjectEditor.xaml.cs"> |
||||
<DependentUpon>ObjectEditor.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\OutlineViewPad.cs" /> |
||||
<Compile Include="Src\ProjectTools.cs" /> |
||||
<Compile Include="Src\PropertyDescriptionService.cs" /> |
||||
<Compile Include="Src\WpfAndWinFormsTopLevelWindowService.cs" /> |
||||
<Compile Include="Src\WpfDisplayBinding.cs" /> |
||||
<Compile Include="Src\WpfDocumentError.xaml.cs"> |
||||
<DependentUpon>WpfDocumentError.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\WpfSideTabItem.cs" /> |
||||
<Compile Include="Src\WpfToolbox.cs" /> |
||||
<Compile Include="Src\WpfViewContent.cs" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="Src\WpfDocumentError.xaml" /> |
||||
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj"> |
||||
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project> |
||||
<Name>ICSharpCode.Core.Presentation</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj"> |
||||
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project> |
||||
<Name>ICSharpCode.Core.WinForms</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj"> |
||||
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project> |
||||
<Name>ICSharpCode.SharpDevelop.Dom</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj"> |
||||
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project> |
||||
<Name>ICSharpCode.SharpDevelop.Widgets</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\FormsDesigner\Project\FormsDesigner.csproj"> |
||||
<Project>{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}</Project> |
||||
<Name>FormsDesigner</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\WpfDesign.Designer\Project\WpfDesign.Designer.csproj"> |
||||
<Project>{78CC29AC-CC79-4355-B1F2-97936DF198AC}</Project> |
||||
<Name>WpfDesign.Designer</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj"> |
||||
<Project>{88DA149F-21B2-48AB-82C4-28FB6BDFD783}</Project> |
||||
<Name>WpfDesign.XamlDom</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\WpfDesign\Project\WpfDesign.csproj"> |
||||
<Project>{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}</Project> |
||||
<Name>WpfDesign</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<Page Include="Src\ImageSourceEditor\ChooseImageDialog.xaml" /> |
||||
<Page Include="Src\ImageSourceEditor\ImageSourceEditor.xaml" /> |
||||
<Page Include="Src\ObjectEditor.xaml" /> |
||||
</ItemGroup> |
||||
<ItemGroup /> |
||||
</Project> |
@ -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; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,82 @@
@@ -0,0 +1,82 @@
|
||||
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(); |
||||
} |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -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))); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
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; |
||||
} |
||||
} |
||||
} |
@ -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"> |
||||
<Controls:EnumButton DataContext="{Binding ElementName=PART_DesignContent}" Margin="0" MinWidth="16" 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/Raster.png" Stretch="Uniform" /> |
||||
</Controls:EnumButton> |
||||
<Controls:EnumButton Margin="0" MinWidth="16" 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/Snapline.png" Stretch="Uniform" /> |
||||
</Controls:EnumButton> |
||||
</StackPanel> |
||||
</Controls:ZoomControl.AdditionalControls> |
||||
|
||||
<ContentControl x:Name="PART_DesignContent" /> |
||||
</Controls:ZoomControl> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</ResourceDictionary> |
||||
|
@ -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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,128 @@
@@ -0,0 +1,128 @@
|
||||
// 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 |
||||
{ |
||||
int raster = 5; |
||||
|
||||
Canvas surface; |
||||
AdornerPanel adornerPanel; |
||||
private bool rasterDrawn = false; |
||||
|
||||
public override void BeginPlacement(PlacementOperation operation) |
||||
{ |
||||
base.BeginPlacement(operation); |
||||
|
||||
try { |
||||
raster = ((DesignPanel) ExtendedItem.Services.DesignPanel).RasterWidth; |
||||
} |
||||
catch (Exception ex) |
||||
{ } |
||||
|
||||
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; |
||||
|
||||
if (!((DesignPanel) ExtendedItem.Services.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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,88 @@
@@ -0,0 +1,88 @@
|
||||
// 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 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); |
||||
|
||||
AdornerPanel.SetPlacement(renderTransformOriginThumb, |
||||
new RelativePlacement(HorizontalAlignment.Left, VerticalAlignment.Top){ XRelativeToContentWidth = pRel.X, YRelativeToContentHeight = pRel.Y }); |
||||
|
||||
this.ExtendedItem.Properties.GetProperty(FrameworkElement.RenderTransformOriginProperty).SetValue(new Point(pRel.X,pRel.Y)); |
||||
} |
||||
|
||||
Point renderTransformOrigin = new Point(0.5, 0.5); |
||||
|
||||
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}); |
||||
} |
||||
|
||||
void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
||||
{ } |
||||
|
||||
protected override void OnRemove() |
||||
{ |
||||
base.OnRemove(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,176 @@
@@ -0,0 +1,176 @@
|
||||
// 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() |
||||
{ |
||||
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; |
||||
} |
||||
} |
||||
} |
||||
} |
After Width: | Height: | Size: 208 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 258 B |
After Width: | Height: | Size: 573 B |
After Width: | Height: | Size: 204 B |
After Width: | Height: | Size: 289 B |
After Width: | Height: | Size: 178 B |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 288 B |
@ -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.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 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 |
||||
} |
||||
} |
||||
|
@ -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/group.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/sort.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/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/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> |
@ -0,0 +1,155 @@
@@ -0,0 +1,155 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Controls.Primitives; |
||||
using System.Windows.Media; |
||||
using System.Diagnostics; |
||||
using ICSharpCode.WpfDesign.Designer.Controls; |
||||
|
||||
namespace ICSharpCode.WpfDesign.Designer.ThumbnailView |
||||
{ |
||||
public class ThumbnailView : Control, INotifyPropertyChanged |
||||
{ |
||||
public DesignSurface DesignSurface |
||||
{ |
||||
get { return (DesignSurface)GetValue(DesignSurfaceProperty); } |
||||
set { SetValue(DesignSurfaceProperty, value); } |
||||
} |
||||
|
||||
public static readonly DependencyProperty DesignSurfaceProperty = |
||||
DependencyProperty.Register("DesignSurface", typeof(DesignSurface), typeof(ThumbnailView), new PropertyMetadata(OnDesignSurfaceChanged)); |
||||
|
||||
private static void OnDesignSurfaceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||
{ |
||||
var ctl = d as ThumbnailView; |
||||
|
||||
|
||||
if (ctl.oldSurface != null) |
||||
ctl.oldSurface.LayoutUpdated -= ctl.DesignSurface_LayoutUpdated; |
||||
|
||||
ctl.oldSurface = ctl.DesignSurface; |
||||
ctl.scrollViewer = null; |
||||
|
||||
if (ctl.DesignSurface != null) |
||||
{ |
||||
ctl.DesignSurface.LayoutUpdated += ctl.DesignSurface_LayoutUpdated; |
||||
} |
||||
|
||||
ctl.OnPropertyChanged("ScrollViewer"); |
||||
} |
||||
|
||||
static ThumbnailView() |
||||
{ |
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ThumbnailView), new FrameworkPropertyMetadata(typeof(ThumbnailView))); |
||||
} |
||||
|
||||
public ScrollViewer ScrollViewer |
||||
{ |
||||
get |
||||
{ |
||||
if (DesignSurface != null && scrollViewer == null) |
||||
scrollViewer = DesignSurface.TryFindChild<ZoomControl>(); |
||||
|
||||
return scrollViewer; |
||||
} |
||||
} |
||||
|
||||
|
||||
void DesignSurface_LayoutUpdated(object sender, EventArgs e) |
||||
{ |
||||
if (this.scrollViewer == null) |
||||
OnPropertyChanged("ScrollViewer"); |
||||
|
||||
if (this.scrollViewer != null) |
||||
{ |
||||
double scale, xOffset, yOffset; |
||||
this.InvalidateScale(out scale, out xOffset, out yOffset); |
||||
|
||||
this.zoomThumb.Width = scrollViewer.ViewportWidth * scale; |
||||
this.zoomThumb.Height = scrollViewer.ViewportHeight * scale; |
||||
|
||||
Canvas.SetLeft(this.zoomThumb, xOffset + this.ScrollViewer.HorizontalOffset*scale); |
||||
Canvas.SetTop(this.zoomThumb, yOffset + this.ScrollViewer.VerticalOffset*scale); |
||||
} |
||||
} |
||||
|
||||
private DesignSurface oldSurface; |
||||
private ZoomControl scrollViewer; |
||||
private Canvas zoomCanvas; |
||||
private Thumb zoomThumb; |
||||
|
||||
public override void OnApplyTemplate() |
||||
{ |
||||
base.OnApplyTemplate(); |
||||
|
||||
this.zoomThumb = Template.FindName("PART_ZoomThumb", this) as Thumb; |
||||
this.zoomCanvas = Template.FindName("PART_ZoomCanvas", this) as Canvas; |
||||
|
||||
this.zoomThumb.DragDelta += this.Thumb_DragDelta; |
||||
|
||||
|
||||
} |
||||
|
||||
private void Thumb_DragDelta(object sender, DragDeltaEventArgs e) |
||||
{ |
||||
if (DesignSurface != null) |
||||
{ |
||||
if (scrollViewer != null) |
||||
{ |
||||
double scale, xOffset, yOffset; |
||||
this.InvalidateScale(out scale, out xOffset, out yOffset); |
||||
|
||||
scrollViewer.ScrollToHorizontalOffset(scrollViewer.HorizontalOffset + e.HorizontalChange / scale); |
||||
scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + e.VerticalChange / scale); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void InvalidateScale(out double scale, out double xOffset, out double yOffset) |
||||
{ |
||||
var designedElement = this.DesignSurface.DesignContext.RootItem.Component as FrameworkElement; |
||||
|
||||
var fac1 = designedElement.ActualWidth / zoomCanvas.ActualWidth; |
||||
var fac2 = designedElement.ActualHeight / zoomCanvas.ActualHeight; |
||||
|
||||
// zoom canvas size
|
||||
double x = this.zoomCanvas.ActualWidth; |
||||
double y = this.zoomCanvas.ActualHeight; |
||||
|
||||
if (fac1 < fac2) |
||||
{ |
||||
x = designedElement.ActualWidth / fac2; |
||||
xOffset = (zoomCanvas.ActualWidth - x) / 2; |
||||
yOffset = 0; |
||||
} |
||||
else |
||||
{ |
||||
y = designedElement.ActualHeight / fac1; |
||||
xOffset = 0; |
||||
yOffset = (zoomCanvas.ActualHeight - y) / 2; |
||||
} |
||||
|
||||
double w = designedElement.ActualWidth; |
||||
double h = designedElement.ActualHeight; |
||||
|
||||
double scaleX = x / w; |
||||
double scaleY = y / h; |
||||
|
||||
scale = (scaleX < scaleY) ? scaleX : scaleY; |
||||
|
||||
xOffset += (x - scale * w) / 2; |
||||
yOffset += (y - scale * h) / 2; |
||||
} |
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
protected virtual void OnPropertyChanged(string propertyName) |
||||
{ |
||||
PropertyChangedEventHandler handler = PropertyChanged; |
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:thumbnailView="clr-namespace:ICSharpCode.WpfDesign.Designer.ThumbnailView"> |
||||
|
||||
<Style TargetType="{x:Type thumbnailView:ThumbnailView}"> |
||||
<Setter Property="SnapsToDevicePixels" Value="true" /> |
||||
<Setter Property="HorizontalAlignment" Value="Stretch" /> |
||||
<Setter Property="VerticalAlignment" Value="Stretch" /> |
||||
<Setter Property="Padding" Value="5" /> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type thumbnailView:ThumbnailView}"> |
||||
<Border CornerRadius="1" |
||||
ClipToBounds="True" |
||||
BorderThickness="1" |
||||
Background="#EEE" |
||||
BorderBrush="DimGray"> |
||||
<Grid> |
||||
<Canvas Margin="{TemplateBinding Padding}" Name="PART_ZoomCanvas"> |
||||
<Canvas.Background> |
||||
<VisualBrush Stretch="Uniform" Visual="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ScrollViewer.Content}" /> |
||||
</Canvas.Background> |
||||
<Thumb Name="PART_ZoomThumb" Cursor="SizeAll"> |
||||
<Thumb.Style> |
||||
<Style TargetType="Thumb"> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="Thumb"> |
||||
<Rectangle StrokeThickness="1" Stroke="Black" Fill="Transparent" /> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</Thumb.Style> |
||||
</Thumb> |
||||
</Canvas> |
||||
</Grid> |
||||
</Border> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</ResourceDictionary> |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
// 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; |
||||
|
||||
namespace ICSharpCode.WpfDesign.Designer |
||||
{ |
||||
/// <summary>
|
||||
/// Description of Translations.
|
||||
/// </summary>
|
||||
public class Translations |
||||
{ |
||||
private static Translations _instance; |
||||
public static Translations Instance { |
||||
get { |
||||
if (_instance == null) |
||||
_instance = new Translations(); |
||||
return _instance; |
||||
} protected set { |
||||
_instance = value; |
||||
} |
||||
} |
||||
|
||||
public virtual string PressAltText { |
||||
get { |
||||
return "Press \"Alt\" to Enter Container"; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,113 @@
@@ -0,0 +1,113 @@
|
||||
using System.Security.Cryptography; |
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.WpfDesign.XamlDom |
||||
{ |
||||
/// <summary>
|
||||
/// Helper Class for the Design Time Properties used by VS and Blend
|
||||
/// </summary>
|
||||
public class DesignTimeProperties : FrameworkElement |
||||
{ |
||||
#region IsHidden
|
||||
|
||||
public static bool GetIsHidden(DependencyObject obj) |
||||
{ |
||||
return (bool)obj.GetValue(IsHiddenProperty); |
||||
} |
||||
|
||||
public static void SetIsHidden(DependencyObject obj, bool value) |
||||
{ |
||||
obj.SetValue(IsHiddenProperty, value); |
||||
} |
||||
|
||||
public static readonly DependencyProperty IsHiddenProperty = |
||||
DependencyProperty.RegisterAttached("IsHidden", typeof(bool), typeof(DesignTimeProperties)); |
||||
|
||||
#endregion
|
||||
|
||||
#region IsLocked
|
||||
|
||||
public static bool GetIsLocked(DependencyObject obj) |
||||
{ |
||||
return (bool)obj.GetValue(IsLockedProperty); |
||||
} |
||||
|
||||
public static void SetIsLocked(DependencyObject obj, bool value) |
||||
{ |
||||
obj.SetValue(IsLockedProperty, value); |
||||
} |
||||
|
||||
public static readonly DependencyProperty IsLockedProperty = |
||||
DependencyProperty.RegisterAttached("IsLocked", typeof(bool), typeof(DesignTimeProperties)); |
||||
|
||||
#endregion
|
||||
|
||||
#region DataContext
|
||||
|
||||
public static object GetDataContext(DependencyObject obj) |
||||
{ |
||||
return (object)obj.GetValue(DataContextProperty); |
||||
} |
||||
|
||||
public static void SetDataContext(DependencyObject obj, bool value) |
||||
{ |
||||
obj.SetValue(DataContextProperty, value); |
||||
} |
||||
|
||||
public static readonly DependencyProperty DataContextProperty = |
||||
DependencyProperty.RegisterAttached("DataContext", typeof(object), typeof(DesignTimeProperties)); |
||||
|
||||
#endregion
|
||||
|
||||
#region DesignSource
|
||||
|
||||
public static object GetDesignSource(DependencyObject obj) |
||||
{ |
||||
return (object)obj.GetValue(DesignSourceProperty); |
||||
} |
||||
|
||||
public static void SetDesignSource(DependencyObject obj, bool value) |
||||
{ |
||||
obj.SetValue(DesignSourceProperty, value); |
||||
} |
||||
|
||||
public static readonly DependencyProperty DesignSourceProperty = |
||||
DependencyProperty.RegisterAttached("DesignSource", typeof(object), typeof(DesignTimeProperties)); |
||||
|
||||
#endregion
|
||||
|
||||
#region DesignWidth
|
||||
|
||||
public static double GetDesignWidth(DependencyObject obj) |
||||
{ |
||||
return (double)obj.GetValue(DesignWidthProperty); |
||||
} |
||||
|
||||
public static void SetDesignWidth(DependencyObject obj, double value) |
||||
{ |
||||
obj.SetValue(DesignWidthProperty, value); |
||||
} |
||||
|
||||
public static readonly DependencyProperty DesignWidthProperty = |
||||
DependencyProperty.RegisterAttached("DesignWidth", typeof(double), typeof(DesignTimeProperties)); |
||||
|
||||
#endregion
|
||||
|
||||
#region DesignHeight
|
||||
|
||||
public static double GetDesignHeight(DependencyObject obj) |
||||
{ |
||||
return (double)obj.GetValue(DesignHeightProperty); |
||||
} |
||||
|
||||
public static void SetDesignHeight(DependencyObject obj, double value) |
||||
{ |
||||
obj.SetValue(DesignHeightProperty, value); |
||||
} |
||||
|
||||
public static readonly DependencyProperty DesignHeightProperty = |
||||
DependencyProperty.RegisterAttached("DesignHeight", typeof(double), typeof(DesignTimeProperties)); |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
using System.Security.Cryptography; |
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.WpfDesign.XamlDom |
||||
{ |
||||
/// <summary>
|
||||
/// Helper Class for the Markup Compatibility Properties used by VS and Blend
|
||||
/// </summary>
|
||||
public class MarkupCompatibilityProperties : FrameworkElement |
||||
{ |
||||
#region Ignorable
|
||||
|
||||
public static string GetIgnorable(DependencyObject obj) |
||||
{ |
||||
return (string)obj.GetValue(IgnorableProperty); |
||||
} |
||||
|
||||
public static void SetIgnorable(DependencyObject obj, string value) |
||||
{ |
||||
obj.SetValue(IgnorableProperty, value); |
||||
} |
||||
|
||||
public static readonly DependencyProperty IgnorableProperty = |
||||
DependencyProperty.RegisterAttached("Ignorable", typeof(string), typeof(MarkupCompatibilityProperties)); |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -1,92 +1,94 @@
@@ -1,92 +1,94 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{88DA149F-21B2-48AB-82C4-28FB6BDFD783}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.WpfDesign.XamlDom</RootNamespace> |
||||
<AssemblyName>ICSharpCode.WpfDesign.XamlDom</AssemblyName> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<SignAssembly>True</SignAssembly> |
||||
<AssemblyOriginatorKeyFile>..\..\..\..\..\Main\ICSharpCode.SharpDevelop.snk</AssemblyOriginatorKeyFile> |
||||
<DelaySign>False</DelaySign> |
||||
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode> |
||||
<RunCodeAnalysis>False</RunCodeAnalysis> |
||||
<CodeAnalysisRules>-Microsoft.Globalization#CA1303;-Microsoft.Performance#CA1800</CodeAnalysisRules> |
||||
<OutputPath>..\..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\</OutputPath> |
||||
<DocumentationFile>..\..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\ICSharpCode.WpfDesign.XamlDom.xml</DocumentationFile> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<Optimize>False</Optimize> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="PresentationCore"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xaml" /> |
||||
<Reference Include="WindowsBase"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="..\..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="AssemblyInfo.cs" /> |
||||
<Compile Include="CollectionElementsCollection.cs" /> |
||||
<Compile Include="CollectionSupport.cs" /> |
||||
<Compile Include="IXamlErrorSink.cs" /> |
||||
<Compile Include="MarkupExtensionParser.cs" /> |
||||
<Compile Include="MarkupExtensionPrinter.cs" /> |
||||
<Compile Include="NameScopeHelper.cs" /> |
||||
<Compile Include="PositionXmlDocument.cs" /> |
||||
<Compile Include="XamlConstants.cs" /> |
||||
<Compile Include="XamlDocument.cs" /> |
||||
<Compile Include="XamlLoadException.cs" /> |
||||
<Compile Include="XamlObject.cs" /> |
||||
<Compile Include="XamlObjectServiceProvider.cs" /> |
||||
<Compile Include="XamlParser.cs" /> |
||||
<Compile Include="XamlParserSettings.cs" /> |
||||
<Compile Include="XamlProperty.cs" /> |
||||
<Compile Include="XamlPropertyInfo.cs" /> |
||||
<Compile Include="XamlPropertyValue.cs" /> |
||||
<Compile Include="XamlStaticTools.cs" /> |
||||
<Compile Include="XamlTextValue.cs" /> |
||||
<Compile Include="XamlTypeFinder.cs" /> |
||||
<Compile Include="XamlTypeResolverProvider.cs" /> |
||||
</ItemGroup> |
||||
</Project> |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{88DA149F-21B2-48AB-82C4-28FB6BDFD783}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.WpfDesign.XamlDom</RootNamespace> |
||||
<AssemblyName>ICSharpCode.WpfDesign.XamlDom</AssemblyName> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<SignAssembly>True</SignAssembly> |
||||
<AssemblyOriginatorKeyFile>..\..\..\..\..\Main\ICSharpCode.SharpDevelop.snk</AssemblyOriginatorKeyFile> |
||||
<DelaySign>False</DelaySign> |
||||
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode> |
||||
<RunCodeAnalysis>False</RunCodeAnalysis> |
||||
<CodeAnalysisRules>-Microsoft.Globalization#CA1303;-Microsoft.Performance#CA1800</CodeAnalysisRules> |
||||
<OutputPath>..\..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\</OutputPath> |
||||
<DocumentationFile>..\..\..\..\..\..\AddIns\DisplayBindings\WpfDesign\ICSharpCode.WpfDesign.XamlDom.xml</DocumentationFile> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<Optimize>False</Optimize> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="PresentationCore"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xaml" /> |
||||
<Reference Include="WindowsBase"> |
||||
<Private>False</Private> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="..\..\..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="AssemblyInfo.cs" /> |
||||
<Compile Include="CollectionElementsCollection.cs" /> |
||||
<Compile Include="CollectionSupport.cs" /> |
||||
<Compile Include="DesignTimeProperties.cs" /> |
||||
<Compile Include="IXamlErrorSink.cs" /> |
||||
<Compile Include="MarkupCompatibilityProperties.cs" /> |
||||
<Compile Include="MarkupExtensionParser.cs" /> |
||||
<Compile Include="MarkupExtensionPrinter.cs" /> |
||||
<Compile Include="NameScopeHelper.cs" /> |
||||
<Compile Include="PositionXmlDocument.cs" /> |
||||
<Compile Include="XamlConstants.cs" /> |
||||
<Compile Include="XamlDocument.cs" /> |
||||
<Compile Include="XamlLoadException.cs" /> |
||||
<Compile Include="XamlObject.cs" /> |
||||
<Compile Include="XamlObjectServiceProvider.cs" /> |
||||
<Compile Include="XamlParser.cs" /> |
||||
<Compile Include="XamlParserSettings.cs" /> |
||||
<Compile Include="XamlProperty.cs" /> |
||||
<Compile Include="XamlPropertyInfo.cs" /> |
||||
<Compile Include="XamlPropertyValue.cs" /> |
||||
<Compile Include="XamlStaticTools.cs" /> |
||||
<Compile Include="XamlTextValue.cs" /> |
||||
<Compile Include="XamlTypeFinder.cs" /> |
||||
<Compile Include="XamlTypeResolverProvider.cs" /> |
||||
</ItemGroup> |
||||
</Project> |
||||
|
@ -0,0 +1,103 @@
@@ -0,0 +1,103 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Media; |
||||
|
||||
namespace ICSharpCode.WpfDesign |
||||
{ |
||||
public static class UIHelpers |
||||
{ |
||||
public static DependencyObject GetParentObject(this DependencyObject child) |
||||
{ |
||||
if (child == null) return null; |
||||
|
||||
var contentElement = child as ContentElement; |
||||
if (contentElement != null) |
||||
{ |
||||
DependencyObject parent = ContentOperations.GetParent(contentElement); |
||||
if (parent != null) return parent; |
||||
|
||||
var fce = contentElement as FrameworkContentElement; |
||||
return fce != null ? fce.Parent : null; |
||||
} |
||||
|
||||
var frameworkElement = child as FrameworkElement; |
||||
if (frameworkElement != null) |
||||
{ |
||||
DependencyObject parent = frameworkElement.Parent; |
||||
if (parent != null) return parent; |
||||
} |
||||
|
||||
return VisualTreeHelper.GetParent(child); |
||||
} |
||||
|
||||
public static T TryFindParent<T>(this DependencyObject child) where T : DependencyObject |
||||
{ |
||||
DependencyObject parentObject = GetParentObject(child); |
||||
|
||||
if (parentObject == null) return null; |
||||
|
||||
T parent = parentObject as T; |
||||
if (parent != null) |
||||
{ |
||||
return parent; |
||||
} |
||||
|
||||
return TryFindParent<T>(parentObject); |
||||
} |
||||
|
||||
public static T TryFindChild<T>(this DependencyObject parent) where T : DependencyObject |
||||
{ |
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++) |
||||
{ |
||||
DependencyObject child = VisualTreeHelper.GetChild(parent, i); |
||||
|
||||
if (child is T) |
||||
{ |
||||
return (T)child; |
||||
} |
||||
child = TryFindChild<T>(child); |
||||
if (child != null) |
||||
{ |
||||
return (T)child; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static T TryFindChild<T>(DependencyObject parent, string childName) where T : DependencyObject |
||||
{ |
||||
if (parent == null) return null; |
||||
T foundChild = null; |
||||
var childrenCount = VisualTreeHelper.GetChildrenCount(parent); |
||||
for (var i = 0; i < childrenCount; i++) |
||||
{ |
||||
var child = VisualTreeHelper.GetChild(parent, i); |
||||
|
||||
var childType = child as T; |
||||
if (childType == null) |
||||
{ |
||||
foundChild = TryFindChild<T>(child, childName); |
||||
if (foundChild != null) break; |
||||
} |
||||
else if (!string.IsNullOrEmpty(childName)) |
||||
{ |
||||
var frameworkElement = child as FrameworkElement; |
||||
if (frameworkElement != null && frameworkElement.Name == childName) |
||||
{ |
||||
foundChild = (T)child; |
||||
break; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
foundChild = (T)child; |
||||
break; |
||||
} |
||||
} |
||||
return foundChild; |
||||
} |
||||
} |
||||
} |