Skip to content

Commit

Permalink
Add DesignTools Project for the new Designer APIs
Browse files Browse the repository at this point in the history
Add FQNs and Proxy classes for the Control types
 since they should not be referenced by the DesignTools assembly in new Designer system.
  • Loading branch information
Nirmal4G committed Sep 30, 2020
1 parent 4c40a98 commit 42bc139
Show file tree
Hide file tree
Showing 68 changed files with 1,101 additions and 29 deletions.
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@
</AdditionalFiles>
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.VisualStudio.Design.props" Condition="'$(IsDesignProject)' == 'true'"/>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
using Microsoft.Windows.Design.Features;
using Microsoft.Windows.Design.Metadata;
using Microsoft.Windows.Design.Model;
#else
using Microsoft.VisualStudio.DesignTools.Extensibility;
using Microsoft.VisualStudio.DesignTools.Extensibility.Features;
using Microsoft.VisualStudio.DesignTools.Extensibility.Metadata;
using Microsoft.VisualStudio.DesignTools.Extensibility.Model;
#endif

namespace Microsoft.Toolkit.Uwp.UI.Controls.Design
Expand All @@ -18,8 +23,8 @@ internal class DataGridDefaults : DefaultInitializer
{
public override void InitializeDefaults(ModelItem item)
{
item.Properties[nameof(DataGrid.Height)].SetValue(50);
item.Properties[nameof(DataGrid.Width)].SetValue(100);
item.Properties[nameof(DataGrid.Height)].SetValue(50d);
item.Properties[nameof(DataGrid.Width)].SetValue(100d);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,100 @@ internal static partial class ControlTypes
internal static readonly Type DataGridCheckBoxColumn = typeof(DataGridCheckBoxColumn);
internal static readonly Type DataGridTemplateColumn = typeof(DataGridTemplateColumn);
}
#else
internal static partial class ControlTypes
{
internal const string DataGrid = RootNamespace + "." + nameof(DataGrid);
internal const string DataGridColumn = RootNamespace + "." + nameof(DataGridColumn);
internal const string DataGridBoundColumn = RootNamespace + "." + nameof(DataGridBoundColumn);
internal const string DataGridTextColumn = RootNamespace + "." + nameof(DataGridTextColumn);
internal const string DataGridCheckBoxColumn = RootNamespace + "." + nameof(DataGridCheckBoxColumn);
internal const string DataGridTemplateColumn = RootNamespace + "." + nameof(DataGridTemplateColumn);
}

internal static class DataGrid
{
internal const string AlternatingRowBackground = nameof(AlternatingRowBackground);
internal const string AreRowDetailsFrozen = nameof(AreRowDetailsFrozen);
internal const string AreRowGroupHeadersFrozen = nameof(AreRowGroupHeadersFrozen);
internal const string AutoGenerateColumns = nameof(AutoGenerateColumns);
internal const string CanUserReorderColumns = nameof(CanUserReorderColumns);
internal const string CanUserResizeColumns = nameof(CanUserResizeColumns);
internal const string CanUserSortColumns = nameof(CanUserSortColumns);
internal const string CellStyle = nameof(CellStyle);
internal const string ClipboardCopyMode = nameof(ClipboardCopyMode);
internal const string ColumnHeaderHeight = nameof(ColumnHeaderHeight);
internal const string ColumnHeaderStyle = nameof(ColumnHeaderStyle);
internal const string Columns = nameof(Columns);
internal const string ColumnWidth = nameof(ColumnWidth);
internal const string CurrentColumn = nameof(CurrentColumn);
internal const string DragIndicatorStyle = nameof(DragIndicatorStyle);
internal const string DropLocationIndicatorStyle = nameof(DropLocationIndicatorStyle);
internal const string FrozenColumnCount = nameof(FrozenColumnCount);
internal const string GridLinesVisibility = nameof(GridLinesVisibility);
internal const string HeadersVisibility = nameof(HeadersVisibility);
internal const string Height = nameof(Height);
internal const string HorizontalGridLinesBrush = nameof(HorizontalGridLinesBrush);
internal const string HorizontalScrollBarVisibility = nameof(HorizontalScrollBarVisibility);
internal const string IsReadOnly = nameof(IsReadOnly);
internal const string IsValid = nameof(IsValid);
internal const string ItemsSource = nameof(ItemsSource);
internal const string MaxColumnWidth = nameof(MaxColumnWidth);
internal const string MinColumnWidth = nameof(MinColumnWidth);
internal const string RowBackground = nameof(RowBackground);
internal const string RowDetailsTemplate = nameof(RowDetailsTemplate);
internal const string RowDetailsVisibilityMode = nameof(RowDetailsVisibilityMode);
internal const string RowGroupHeaderPropertyNameAlternative = nameof(RowGroupHeaderPropertyNameAlternative);
internal const string RowGroupHeaderStyles = nameof(RowGroupHeaderStyles);
internal const string RowHeaderStyle = nameof(RowHeaderStyle);
internal const string RowHeaderWidth = nameof(RowHeaderWidth);
internal const string RowHeight = nameof(RowHeight);
internal const string RowStyle = nameof(RowStyle);
internal const string SelectedIndex = nameof(SelectedIndex);
internal const string SelectedItem = nameof(SelectedItem);
internal const string SelectedItems = nameof(SelectedItems);
internal const string SelectionMode = nameof(SelectionMode);
internal const string VerticalGridLinesBrush = nameof(VerticalGridLinesBrush);
internal const string VerticalScrollBarVisibility = nameof(VerticalScrollBarVisibility);
internal const string Width = nameof(Width);
}

internal static class DataGridColumn
{
internal const string CanUserResize = nameof(CanUserResize);
internal const string CanUserSort = nameof(CanUserSort);
internal const string Header = nameof(Header);
internal const string HeaderStyle = nameof(HeaderStyle);
internal const string MaxWidth = nameof(MaxWidth);
internal const string MinWidth = nameof(MinWidth);
internal const string SortDirection = nameof(SortDirection);
internal const string Visibility = nameof(Visibility);
internal const string Width = nameof(Width);
}

internal static class DataGridBoundColumn
{
internal const string Binding = nameof(Binding);
}

internal static class DataGridTextColumn
{
internal const string FontFamily = nameof(FontFamily);
internal const string FontSize = nameof(FontSize);
internal const string FontStyle = nameof(FontStyle);
internal const string FontWeight = nameof(FontWeight);
internal const string Foreground = nameof(Foreground);
}

internal static class DataGridCheckBoxColumn
{
internal const string IsThreeState = nameof(IsThreeState);
}

internal static class DataGridTemplateColumn
{
internal const string CellEditingTemplate = nameof(CellEditingTemplate);
internal const string CellTemplate = nameof(CellTemplate);
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#if VS_DESIGNER_PROCESS_ISOLATION
using Microsoft.Windows.Design.Metadata;
#else
using Microsoft.VisualStudio.DesignTools.Extensibility.Metadata;
#endif

[assembly: ProvideMetadata(typeof(MetadataRegistration))]
Expand All @@ -31,6 +33,10 @@ public MetadataRegistration() : base()
AssemblyName an = t.Assembly.GetName();
AssemblyFullName = an.FullName;
XmlResourceName = t.Namespace + ".Design." + an.Name + ".xml";
#else
var AssemblyName = ControlTypes.RootNamespace + ".DataGrid";
AssemblyFullName = $"{AssemblyName}, Version=6.1.0.0, Culture=neutral, PublicKeyToken=null";
XmlResourceName = $"{AssemblyName}.Design.{AssemblyName}.xml";
#endif
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{6BD0BA4A-DE6D-3E87-8F83-63518C31ECD1}</ProjectGuid>
<ProjectGuid>{618C1EA2-CAA6-4ED8-A53B-E8F4B63AEDB8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Toolkit.Uwp.UI.Controls.Design</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.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)' == '' ">x86</Platform>
<ProjectGuid>{6BD0BA4A-DE6D-3E87-8F83-63518C31ECD1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Toolkit.Uwp.UI.Controls.Design</RootNamespace>
<AssemblyName>Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.DesignTools</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetPlatformVersion>8.1</TargetPlatformVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\Debug\uap10.0.17763\Design\</OutputPath>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\Release\uap10.0.17763\Design\</OutputPath>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Runtime" />
<Reference Include="System.ObjectModel" />
<Reference Include="System.Runtime.WindowsRuntime" />
<Reference Include="System.Runtime.InteropServices.WindowsRuntime" />
<Reference Include="Microsoft.VisualStudio.DesignTools.Extensibility">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.DesignTools.Interaction">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Windows, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(MSBuildProgramFiles32)\Windows Kits\10\UnionMetadata\10.0.17763.0\Windows.winmd</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup Label="WinRT References">
<Reference Include="System.Xaml" />
<Reference Include="System.Runtime.WindowsRuntime.UI.Xaml" />
<Reference Include="Windows.Foundation.FoundationContract">
<HintPath>$(ProgramFiles)\Windows Kits\10\References\10.0.17763.0\Windows.Foundation.FoundationContract\3.0.0.0\Windows.Foundation.FoundationContract.winmd</HintPath>
<Aliases>WindowsRuntime</Aliases>
<Private>False</Private>
</Reference>
<Reference Include="Windows.Foundation.UniversalApiContract">
<HintPath>$(ProgramFiles)\Windows Kits\10\References\10.0.17763.0\Windows.Foundation.UniversalApiContract\7.0.0.0\Windows.Foundation.UniversalApiContract.winmd</HintPath>
<Aliases>WindowsRuntime</Aliases>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Design\Common\Constants.cs" Link="Common\Constants.cs" />
<Compile Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Design\Common\MetadataRegistrationBase.cs" Link="Common\MetadataRegistrationBase.cs" />
<Compile Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Design\Common\PlatformTypes.cs" Link="Common\PlatformTypes.cs" />
<Compile Include="Controls\DataGrid.Metadata.cs" />
<Compile Include="Controls\DataGrid.Typedata.cs" />
<Compile Include="MetadataRegistration.cs" />
<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>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\$(Configuration)\uap10.0.17763\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.xml">
<Link>Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.xml</Link>
<Visible>False</Visible>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- No-op to avoid build error when packing solution from commandline -->
<Target Name="Pack" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Title>Windows Community Toolkit Controls DataGrid</Title>
<Description>
This library provides a XAML DataGrid control. It is part of the Windows Community Toolkit.

</Description>
<PackageTags>UWP Toolkit Windows Controls XAML DataGrid</PackageTags>
<RootNamespace>Microsoft.Toolkit.Uwp.UI.Controls</RootNamespace>
Expand All @@ -14,7 +14,7 @@

<ItemGroup>
<None Include="VisualStudioToolsManifest.xml" Pack="true" PackagePath="tools" />
<None Include="$(OutDir)\Design\$(MSBuildProjectName).Design.dll;$(OutDir)\Design\$(MSBuildProjectName).Design.pdb" Pack="true" PackagePath="lib\$(TargetFramework)\Design" />
<None Include="$(OutDir)\Design\$(MSBuildProjectName).Design*.dll;$(OutDir)\Design\$(MSBuildProjectName).Design*.pdb" Pack="true" PackagePath="lib\$(TargetFramework)\Design" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions Microsoft.Toolkit.Uwp.UI.Controls.Design/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

namespace Microsoft.Toolkit.Uwp.UI.Controls.Design
{
#if !VS_DESIGNER_PROCESS_ISOLATION
internal static partial class ControlTypes
{
// HACK: Don't forget to update, if the namespace changes.
public const string RootNamespace = "Microsoft.Toolkit.Uwp.UI.Controls";
}
#endif
/// <summary>
/// Names for ToolboxCategoryAttribute.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#if VS_DESIGNER_PROCESS_ISOLATION
using Microsoft.Windows.Design;
using Microsoft.Windows.Design.Metadata;
#else
using Microsoft.VisualStudio.DesignTools.Extensibility;
using Microsoft.VisualStudio.DesignTools.Extensibility.Metadata;
#endif

namespace Microsoft.Toolkit.Uwp.Design.Common
Expand Down Expand Up @@ -141,6 +144,8 @@ private void AddDescriptions(AttributeTableBuilder builder)
var type = Type.GetType(typeName + ", " + AssemblyFullName);
#if VS_DESIGNER_PROCESS_ISOLATION
var typeID = type;
#else
var typeID = typeName;
#endif
if (type != null && type.IsPublic && type.IsClass && type.IsSubclassOf(PlatformTypes.DependencyObject))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

#if VS_DESIGNER_PROCESS_ISOLATION
using Microsoft.Windows.Design.Metadata;
#else
using Microsoft.VisualStudio.DesignTools.Extensibility;
using Microsoft.VisualStudio.DesignTools.Extensibility.Metadata;
#endif

namespace Microsoft.Toolkit.Uwp.Design.Types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#if VS_DESIGNER_PROCESS_ISOLATION
using Microsoft.Windows.Design;
using Microsoft.Windows.Design.Metadata;
#else
using Microsoft.VisualStudio.DesignTools.Extensibility;
using Microsoft.VisualStudio.DesignTools.Extensibility.Metadata;
#endif

namespace Microsoft.Toolkit.Uwp.UI.Controls.Design
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,19 @@ internal static partial class ControlTypes
{
internal static readonly Type AdaptiveGridView = typeof(AdaptiveGridView);
}
#else
internal static partial class ControlTypes
{
internal const string AdaptiveGridView = RootNamespace + "." + nameof(AdaptiveGridView);
}

internal static class AdaptiveGridView
{
internal const string DesiredWidth = nameof(DesiredWidth);
internal const string ItemClickCommand = nameof(ItemClickCommand);
internal const string ItemHeight = nameof(ItemHeight);
internal const string OneRowModeEnabled = nameof(OneRowModeEnabled);
internal const string StretchContentForSingleRow = nameof(StretchContentForSingleRow);
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#if VS_DESIGNER_PROCESS_ISOLATION
using Microsoft.Windows.Design;
using Microsoft.Windows.Design.Metadata;
#else
using Microsoft.VisualStudio.DesignTools.Extensibility;
using Microsoft.VisualStudio.DesignTools.Extensibility.Metadata;
#endif

namespace Microsoft.Toolkit.Uwp.UI.Controls.Design
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,19 @@ internal static partial class ControlTypes
{
internal static readonly Type BladeItem = typeof(BladeItem);
}
#else
internal static partial class ControlTypes
{
internal const string BladeItem = RootNamespace + "." + nameof(BladeItem);
}

internal static class BladeItem
{
internal const string CloseButtonBackground = nameof(CloseButtonBackground);
internal const string CloseButtonForeground = nameof(CloseButtonForeground);
internal const string IsOpen = nameof(IsOpen);
internal const string TitleBarBackground = nameof(TitleBarBackground);
internal const string TitleBarVisibility = nameof(TitleBarVisibility);
}
#endif
}
Loading

0 comments on commit 42bc139

Please sign in to comment.