Merge remote-tracking branch 'remotes/mblake/discovery'

This commit is contained in:
jogibear9988 2016-05-01 19:18:53 +02:00
Родитель a3a68b61a6 05a97a79e6
Коммит 34cc930865
25 изменённых файлов: 1100 добавлений и 1 удалений

6
MyDesigner/App.config Normal file
Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
</configuration>

9
MyDesigner/App.xaml Normal file
Просмотреть файл

@ -0,0 +1,9 @@
<Application x:Class="MyDesigner.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyDesigner"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

17
MyDesigner/App.xaml.cs Normal file
Просмотреть файл

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace MyDesigner
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,102 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using System.IO;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Collections;
namespace ICSharpCode.XamlDesigner
{
static class ExtensionMethods
{
public static IEnumerable<string> Paths(this IDataObject data)
{
string[] paths = (string[])data.GetData(DataFormats.FileDrop);
if (paths != null) {
foreach (var path in paths) {
yield return path;
}
}
}
public static T GetObject<T>(this IDataObject data)
{
return (T)data.GetData(typeof(T).FullName);
}
public static Stream ToStream(this string s)
{
return new MemoryStream(Encoding.UTF8.GetBytes(s));
}
public static void AddRange<T>(this ObservableCollection<T> col, IEnumerable<T> items)
{
foreach (var item in items) {
col.Add(item);
}
}
public static void KeepSyncronizedWith<S>(this IList target, ObservableCollection<S> source, Func<S, object> convert)
{
target.Clear();
foreach (var item in source) {
target.Add(convert(item));
}
source.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e) {
switch (e.Action) {
case NotifyCollectionChangedAction.Add:
target.Add(convert((S)e.NewItems[0]));
break;
case NotifyCollectionChangedAction.Remove:
target.RemoveAt(e.OldStartingIndex);
break;
case NotifyCollectionChangedAction.Move:
target.RemoveAt(e.OldStartingIndex);
target.Insert(e.NewStartingIndex, e.NewItems[0]);
break;
case NotifyCollectionChangedAction.Replace:
target[e.NewStartingIndex] = convert((S)e.NewItems[0]);
break;
case NotifyCollectionChangedAction.Reset:
target.Clear();
break;
}
};
}
public static object GetDataContext(this RoutedEventArgs e)
{
var f = e.OriginalSource as FrameworkElement;
if (f != null) return f.DataContext;
return null;
}
}
}

Просмотреть файл

@ -0,0 +1,38 @@
<Window x:Class="MyDesigner.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MyDesigner"
xmlns:sd="http://sharpdevelop.net"
mc:Ignorable="d"
Title="MainWindow" Height="600" Width="800">
<Grid x:Name="MainGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"
Orientation="Vertical"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock Text="Toolbox"/>
<local:MyToolboxView VerticalAlignment="Stretch">
</local:MyToolboxView>
</StackPanel>
<Grid x:Name="DesignSurfaceGrid"
Grid.Column="1">
</Grid>
<Grid x:Name="PropertyGridGrid"
Grid.Column="2">
<sd:PropertyGridView x:Name="uxPropertyGridView"
SelectedItems="{Binding DataContext.DesignSurface.DesignContext.Services.Selection.SelectedItems, ElementName=MainGrid, FallbackValue={x:Null}}"/>
</Grid>
</Grid>
</Window>

Просмотреть файл

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Xml;
using System.IO;
using MyTestAssembly;
using ICSharpCode.WpfDesign.Designer.Xaml;
using ICSharpCode.WpfDesign.Designer.PropertyGrid;
using ICSharpCode.WpfDesign;
namespace MyDesigner
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
//From the simple example, enough text to show a root container in the designer.
private static string xaml = @"<Grid
xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
xmlns:d=""http://schemas.microsoft.com/expression/blend/2008""
xmlns:mc=""http://schemas.openxmlformats.org/markup-compatibility/2006""
mc:Ignorable=""d""
x:Name=""rootElement"" Background=""White""></Grid>";
public MainWindow()
{
DataContext = MyDesignerModel.Instance;
InitializeComponent();
//Plug the design surface into the grid that is its parent
this.DesignSurfaceGrid.Children.Add(MyDesignerModel.Instance.DesignSurface);
//For testing property getting/setting only.
MyDesignerModel.Instance.PropertyGrid = this.uxPropertyGridView.PropertyGrid;
//Load the design surface with some minimal XAML that we have hardcoded.
using (var xmlReader = XmlReader.Create(new StringReader(xaml)))
{
MyDesignerModel.Instance.DesignSurface.LoadDesigner(xmlReader, new XamlLoadSettings());
}
//We want to supply our own implementation of IComponentPropertyService so we return just the properties that we want.
//This would probably go better in the MyDesignerModel class, but have to wait until after the DesignContext has been created.
MyDesignerModel.Instance.DesignSurface.DesignContext.Services.AddOrReplaceService(typeof(IComponentPropertyService), new MyComponentPropertyService());
}
}
}

Просмотреть файл

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E65E2846-F038-4F38-A958-8F5DE7DFFBCD}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyDesigner</RootNamespace>
<AssemblyName>MyDesigner</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="ExtensionMethods.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="MyToolboxView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="MyToolbox.cs" />
<Compile Include="MyToolboxView.xaml.cs">
<DependentUpon>MyToolboxView.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyTestAssembly\MyTestAssembly.csproj">
<Project>{dc6bd4a4-bf01-4a4b-bef6-9b17d6ab2e06}</Project>
<Name>MyTestAssembly</Name>
</ProjectReference>
<ProjectReference Include="..\WpfDesign.Designer\Project\WpfDesign.Designer.csproj">
<Project>{78cc29ac-cc79-4355-b1f2-97936df198ac}</Project>
<Name>WpfDesign.Designer</Name>
</ProjectReference>
<ProjectReference Include="..\WpfDesign\Project\WpfDesign.csproj">
<Project>{66a378a1-e9f4-4ad5-8946-d0ec06c2902f}</Project>
<Name>WpfDesign</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

40
MyDesigner/MyToolbox.cs Normal file
Просмотреть файл

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using MyTestAssembly;
namespace MyDesigner
{
public class MyToolbox
{
public MyToolbox()
{
MyFooNodes = new ObservableCollection<MyFooNode>();
//For poc, just add a node to our collection for each member of MyFooEnum.
MyFooNodes.Add(new MyFooNode() { FooType = MyFooEnum.ButtonWidget });
MyFooNodes.Add(new MyFooNode() { FooType = MyFooEnum.TextWidget });
}
public static MyToolbox Instance = new MyToolbox();
public ObservableCollection<MyFooNode> MyFooNodes { get; private set; }
}
//Represents either a widget or form controls node. A folder structure would require a different node for folders? Like the AssemblyNode in Toolbox.
public class MyFooNode
{
public MyFooEnum FooType { get; set; }
public string Name
{
get
{
return this.FooType.ToString();
}
}
}
}

Просмотреть файл

@ -0,0 +1,23 @@
<UserControl x:Class="MyDesigner.MyToolboxView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MyDesigner"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<DataTemplate DataType="{x:Type local:MyFooNode}">
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</UserControl.Resources>
<Border BorderBrush="Black" BorderThickness="1">
<TreeView x:Name="uxTreeView"
ItemsSource="{Binding MyFooNodes}"
BorderThickness="0"/>
</Border>
</UserControl>

Просмотреть файл

@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ICSharpCode.WpfDesign.Designer.OutlineView;
using ICSharpCode.XamlDesigner; //Only for the ExtensionMethods class.
using ICSharpCode.WpfDesign.Designer.Services;
using MyTestAssembly;
namespace MyDesigner
{
/// <summary>
/// Interaction logic for MyToolboxView.xaml
/// </summary>
public partial class MyToolboxView : UserControl
{
public MyToolboxView()
{
this.DataContext = MyToolbox.Instance;
InitializeComponent();
new DragListener(this).DragStarted += Toolbox_DragStarted;
uxTreeView.SelectedItemChanged += uxTreeView_SelectedItemChanged;
uxTreeView.GotKeyboardFocus += uxTreeView_GotKeyboardFocus;
}
void uxTreeView_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
PrepareTool(uxTreeView.SelectedItem as MyFooNode, false);
}
void uxTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
PrepareTool(uxTreeView.SelectedItem as MyFooNode, false);
}
void Toolbox_DragStarted(object sender, MouseButtonEventArgs e)
{
PrepareTool(e.GetDataContext() as MyFooNode, true);
}
void PrepareTool(MyFooNode node, bool drag)
{
if (node != null)
{
//Get the Type we want to use for the MyFooNode being dragged out here.
Type type = GetTypeForFooType(node.FooType);
var tool = new CreateComponentTool(type);
if (MyDesignerModel.Instance.DesignSurface != null)
{
MyDesignerModel.Instance.DesignSurface.DesignContext.Services.Tool.CurrentTool = tool;
if (drag)
{
DragDrop.DoDragDrop(this, tool, DragDropEffects.Copy);
}
}
}
}
private Type GetTypeForFooType(MyFooEnum fooType)
{
Type retVal = null;
if (fooType == MyFooEnum.ButtonWidget)
{
retVal = typeof(MyWidgetHolderView);
}
else if (fooType == MyFooEnum.TextWidget)
retVal = typeof(TextBlock);
return retVal;
}
}
}

Просмотреть файл

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MyDesigner")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyDesigner")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

71
MyDesigner/Properties/Resources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MyDesigner.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MyDesigner.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

30
MyDesigner/Properties/Settings.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MyDesigner.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,37 @@
using ICSharpCode.WpfDesign;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using ICSharpCode.WpfDesign.PropertyGrid;
namespace MyTestAssembly
{
public class MyComponentPropertyService : IComponentPropertyService
{
public IEnumerable<MemberDescriptor> GetAvailableEvents(DesignItem designItem)
{
//We don't want to show events for our design items, so probably throw an exception here?
IEnumerable<EventDescriptor> retVal = TypeHelper.GetAvailableEvents(designItem.ComponentType);
return retVal;
}
public IEnumerable<MemberDescriptor> GetAvailableProperties(DesignItem designItem)
{
IEnumerable<PropertyDescriptor> retVal = TypeHelper.GetAvailableProperties(designItem.Component);
retVal = retVal.Where(c => c.Name == "Foreground");
return retVal;
}
public IEnumerable<MemberDescriptor> GetCommonAvailableProperties(IEnumerable<DesignItem> designItems)
{
IEnumerable<PropertyDescriptor> retVal = TypeHelper.GetCommonAvailableProperties(designItems.Select(t => t.Component));
return retVal;
}
}
}

Просмотреть файл

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ICSharpCode.WpfDesign.Designer;
using ICSharpCode.WpfDesign.Designer.PropertyGrid;
using ICSharpCode.WpfDesign;
namespace MyTestAssembly
{
//Similar to the Shell class used in the sharpdevlop large sample
public class MyDesignerModel
{
public MyDesignerModel()
{
this.m_designSurface = new DesignSurface();
}
public static MyDesignerModel Instance = new MyDesignerModel();
private DesignSurface m_designSurface;
public DesignSurface DesignSurface
{
get { return this.m_designSurface; }
}
public IPropertyGrid PropertyGrid { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyTestAssembly
{
/// <summary>
/// Represents all of the different things that can be dragged onto the design surface.
/// </summary>
public enum MyFooEnum
{
ButtonWidget,
TextWidget
}
}

Просмотреть файл

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DC6BD4A4-BF01-4A4B-BEF6-9B17D6AB2E06}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MyTestAssembly</RootNamespace>
<AssemblyName>MyTestAssembly</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyComponentPropertyService.cs" />
<Compile Include="MyDesignerModel.cs" />
<Compile Include="MyFooEnum.cs" />
<Compile Include="MyWidgetHolderView.xaml.cs">
<DependentUpon>MyWidgetHolderView.xaml</DependentUpon>
</Compile>
<Compile Include="MyWidgetView.xaml.cs">
<DependentUpon>MyWidgetView.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="MyWidgetHolderView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MyWidgetView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WpfDesign.Designer\Project\WpfDesign.Designer.csproj">
<Project>{78cc29ac-cc79-4355-b1f2-97936df198ac}</Project>
<Name>WpfDesign.Designer</Name>
</ProjectReference>
<ProjectReference Include="..\WpfDesign\Project\WpfDesign.csproj">
<Project>{66a378a1-e9f4-4ad5-8946-d0ec06c2902f}</Project>
<Name>WpfDesign</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,20 @@
<UserControl x:Class="MyTestAssembly.MyWidgetHolderView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MyTestAssembly"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Border BorderBrush="Gray" BorderThickness="1" Background="Transparent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="MyWidgetHolderView"/>
<Border Grid.Row="1" Padding="4" Background="Lime"/>
</Grid>
</Border>
</UserControl>

Просмотреть файл

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MyTestAssembly
{
/// <summary>
/// Interaction logic for MyWidgetHolderView.xaml
/// </summary>
public partial class MyWidgetHolderView : UserControl
{
public MyWidgetHolderView()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,12 @@
<UserControl x:Class="MyTestAssembly.MyWidgetView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MyTestAssembly"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid Background="Pink">
<Button Margin="4">MyWidgetView</Button>
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MyTestAssembly
{
/// <summary>
/// Interaction logic for MyWidgetView.xaml
/// </summary>
public partial class MyWidgetView : UserControl
{
public MyWidgetView()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MyTestAssembly")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyTestAssembly")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("dc6bd4a4-bf01-4a4b-bef6-9b17d6ab2e06")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 14
VisualStudioVersion = 14.0.24720.0 VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.XamlDom", "WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj", "{88DA149F-21B2-48AB-82C4-28FB6BDFD783}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign.XamlDom", "WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj", "{88DA149F-21B2-48AB-82C4-28FB6BDFD783}"
EndProject EndProject
@ -15,6 +15,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlDesigner", "XamlDesigne
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleSample", "SimpleSample\SimpleSample.csproj", "{D33AB2C0-2D8A-4539-B7AF-3E2AA8D1081D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleSample", "SimpleSample\SimpleSample.csproj", "{D33AB2C0-2D8A-4539-B7AF-3E2AA8D1081D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyTestAssembly", "MyTestAssembly\MyTestAssembly.csproj", "{DC6BD4A4-BF01-4A4B-BEF6-9B17D6AB2E06}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyDesigner", "MyDesigner\MyDesigner.csproj", "{E65E2846-F038-4F38-A958-8F5DE7DFFBCD}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -45,6 +49,14 @@ Global
{D33AB2C0-2D8A-4539-B7AF-3E2AA8D1081D}.Debug|Any CPU.Build.0 = Debug|Any CPU {D33AB2C0-2D8A-4539-B7AF-3E2AA8D1081D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D33AB2C0-2D8A-4539-B7AF-3E2AA8D1081D}.Release|Any CPU.ActiveCfg = Release|Any CPU {D33AB2C0-2D8A-4539-B7AF-3E2AA8D1081D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D33AB2C0-2D8A-4539-B7AF-3E2AA8D1081D}.Release|Any CPU.Build.0 = Release|Any CPU {D33AB2C0-2D8A-4539-B7AF-3E2AA8D1081D}.Release|Any CPU.Build.0 = Release|Any CPU
{DC6BD4A4-BF01-4A4B-BEF6-9B17D6AB2E06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC6BD4A4-BF01-4A4B-BEF6-9B17D6AB2E06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC6BD4A4-BF01-4A4B-BEF6-9B17D6AB2E06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC6BD4A4-BF01-4A4B-BEF6-9B17D6AB2E06}.Release|Any CPU.Build.0 = Release|Any CPU
{E65E2846-F038-4F38-A958-8F5DE7DFFBCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E65E2846-F038-4F38-A958-8F5DE7DFFBCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E65E2846-F038-4F38-A958-8F5DE7DFFBCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E65E2846-F038-4F38-A958-8F5DE7DFFBCD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE