Skip to content

Commit

Permalink
Merge pull request #3752 from windows-toolkit/dev/split-controls
Browse files Browse the repository at this point in the history
Merge Dev/split controls Refactoring to Main
  • Loading branch information
michael-hawker authored Feb 12, 2021
2 parents e407e07 + c36cccc commit 99f4581
Show file tree
Hide file tree
Showing 405 changed files with 3,105 additions and 1,073 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@
<PackageReference Include="Microsoft.Services.Store.Engagement">
<Version>10.1901.28001</Version>
</PackageReference>
<!-- TODO Reintroduce graph controls
<PackageReference Include="Microsoft.Toolkit.Graph.Controls">
<Version>6.1.0-build.6</Version>
</PackageReference>
-->
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.4.2</Version>
</PackageReference>
Expand Down Expand Up @@ -279,8 +284,10 @@
<Content Include="SamplePages\RemoteDeviceHelper\RemoteDeviceHelper.png" />
<Content Include="SamplePages\ImageCropper\ImageCropper.png" />
<Content Include="SamplePages\StaggeredLayout\StaggeredLayout.png" />
<!-- TODO Reintroduce graph controls
<Content Include="SamplePages\PeoplePicker\PeoplePicker.png" />
<Content Include="SamplePages\PersonView\PersonView.png" />
-->
<Content Include="SamplePages\TokenizingTextBox\TokenizingTextBox.png" />
<Content Include="SamplePages\UniformGrid\UniformGrid.png" />
<Content Include="SamplePages\AdaptiveGridView\AdaptiveGridView.png" />
Expand All @@ -298,7 +305,9 @@
<Content Include="SamplePages\DataGrid\DataGrid.png" />
<Content Include="SamplePages\DispatcherQueueHelper\DispatchQueueHelper.png" />
<Content Include="SamplePages\DockPanel\DockPanel.png" />
<!-- TODO Reintroduce graph controls
<Content Include="SamplePages\LoginButton\LoginButton.png" />
-->
<Content Include="SamplePages\FadeHeader\FadeHeaderBehavior.png" />
<Content Include="SamplePages\FocusTracker\FocusTracker.png" />
<Content Include="SamplePages\BladeView\BladeView.png" />
Expand Down Expand Up @@ -326,8 +335,8 @@
<Content Include="SamplePages\LiveTile\LiveTile.png" />
<Content Include="SamplePages\MarkdownTextBlock\MarkdownTextBlock.png" />
<Content Include="SamplePages\Loading\Loading.png" />
<Content Include="SamplePages\MasterDetailsView\MasterDetailsView.png" />
<Content Include="SamplePages\MasterDetailsView\OneDriveLogo.png" />
<Content Include="SamplePages\ListDetailsView\ListDetailsView.png" />
<Content Include="SamplePages\ListDetailsView\OneDriveLogo.png" />
<Content Include="SamplePages\Menu\Menu.png" />
<Content Include="SamplePages\Microsoft Translator Service\TranslatorService.png" />
<Content Include="SamplePages\NetworkHelper\NetworkHelper.png" />
Expand Down Expand Up @@ -396,7 +405,7 @@
<Content Include="SamplePages\DropShadowPanel\DropShadowPanelXaml.bind" />
<Content Include="SamplePages\Object Storage\ObjectStorageCode.bind" />
<Content Include="SamplePages\BackgroundTaskHelper\BackgroundTaskHelperCode.bind" />
<Content Include="SamplePages\MasterDetailsView\MasterDetailsView.bind" />
<Content Include="SamplePages\ListDetailsView\ListDetailsView.bind" />
<Content Include="SamplePages\NetworkHelper\NetworkHelperCode.bind" />
<Content Include="SamplePages\PrintHelper\PrintHelperCode.bind" />
<Content Include="SamplePages\SystemInformation\SystemInformationCode.bind" />
Expand All @@ -411,7 +420,7 @@
<SubType>Designer</SubType>
</Content>
<Content Include="SamplePages\WrapPanel\WrapPanel.bind" />
<Content Include="SamplePages\MasterDetailsView\MasterDetailsViewCode.bind" />
<Content Include="SamplePages\ListDetailsView\ListDetailsViewCode.bind" />
<Content Include="SamplePages\Microsoft Translator Service\MicrosoftTranslatorCode.bind" />
<Content Include="SamplePages\MarkdownTextBlock\MarkdownTextBlock.bind" />
<Content Include="SamplePages\MarkdownTextBlock\InitialContent.md" />
Expand Down Expand Up @@ -470,9 +479,11 @@
<SubType>Designer</SubType>
</Content>
<Content Include="SamplePages\CameraPreview\CameraPreviewXaml.bind" />
<!-- TODO Reintroduce graph controls
<Content Include="SamplePages\LoginButton\LoginButtonXaml.bind" />
<Content Include="SamplePages\PeoplePicker\PeoplePickerXaml.bind" />
<Content Include="SamplePages\PersonView\PersonViewXaml.bind" />
-->
<Content Include="SamplePages\GazeInteraction\GazeInteractionXaml.bind">
<SubType>Designer</SubType>
</Content>
Expand Down Expand Up @@ -654,12 +665,14 @@
<Compile Include="Pages\SampleController.xaml.cs">
<DependentUpon>SampleController.xaml</DependentUpon>
</Compile>
<!-- TODO Reintroduce graph controls
<Compile Include="SamplePages\PeoplePicker\PeoplePickerPage.xaml.cs">
<DependentUpon>PeoplePickerPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\PersonView\PersonViewPage.xaml.cs">
<DependentUpon>PersonViewPage.xaml</DependentUpon>
</Compile>
-->
<Compile Include="SamplePages\AdvancedCollectionView\AdvancedCollectionViewPage.xaml.cs">
<DependentUpon>AdvancedCollectionViewPage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -700,9 +713,11 @@
<Compile Include="SamplePages\BackdropBlurBrush\BackdropBlurBrushPage.xaml.cs">
<DependentUpon>BackdropBlurBrushPage.xaml</DependentUpon>
</Compile>
<!-- TODO Reintroduce graph controls
<Compile Include="SamplePages\LoginButton\LoginButtonPage.xaml.cs">
<DependentUpon>LoginButtonPage.xaml</DependentUpon>
</Compile>
-->
<Compile Include="SamplePages\DataGrid\DataGridPage.xaml.cs">
<DependentUpon>DataGridPage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -851,8 +866,8 @@
<Compile Include="SamplePages\Loading\LoadingPage.xaml.cs">
<DependentUpon>LoadingPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\MasterDetailsView\MasterDetailsViewPage.xaml.cs">
<DependentUpon>MasterDetailsViewPage.xaml</DependentUpon>
<Compile Include="SamplePages\ListDetailsView\ListDetailsViewPage.cs">
<DependentUpon>ListDetailsViewPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\ImageCache\ImageCachePage.xaml.cs">
<DependentUpon>ImageCachePage.xaml</DependentUpon>
Expand Down Expand Up @@ -1039,6 +1054,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<!-- TODO Reintroduce graph controls
<Page Include="SamplePages\PeoplePicker\PeoplePickerPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand All @@ -1047,6 +1063,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
-->
<Page Include="SamplePages\BackdropGammaTransferBrush\BackdropGammaTransferBrushPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -1131,10 +1148,12 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<!-- TODO Reintroduce graph controls
<Page Include="SamplePages\LoginButton\LoginButtonPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
-->
<Page Include="SamplePages\FocusTracker\FocusTrackerPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -1299,7 +1318,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SamplePages\MasterDetailsView\MasterDetailsViewPage.xaml">
<Page Include="SamplePages\ListDetailsView\ListDetailsViewPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down Expand Up @@ -1457,6 +1476,10 @@
<Project>{daeb9cec-c817-33b2-74b2-bc379380db72}</Project>
<Name>Microsoft.Toolkit.Uwp.UI.Controls.DataGrid</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Input\Microsoft.Toolkit.Uwp.UI.Controls.Input.csproj">
<Project>{af1be4e9-e2e1-4729-b076-b3725d8e21ee}</Project>
<Name>Microsoft.Toolkit.Uwp.UI.Controls.Input</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Layout\Microsoft.Toolkit.Uwp.UI.Controls.Layout.csproj">
<Project>{cb444381-18ba-4a51-bb32-3a498bcc1e99}</Project>
<Name>Microsoft.Toolkit.Uwp.UI.Controls.Layout</Name>
Expand All @@ -1465,9 +1488,17 @@
<Project>{6fedf199-b052-49dd-8f3e-2a9224998e0f}</Project>
<Name>Microsoft.Toolkit.Uwp.UI.Controls.Markdown</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Controls\Microsoft.Toolkit.Uwp.UI.Controls.csproj">
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Media\Microsoft.Toolkit.Uwp.UI.Controls.Media.csproj">
<Project>{43bd2a36-9e12-4788-80ae-2377e41e6d05}</Project>
<Name>Microsoft.Toolkit.Uwp.UI.Controls.Media</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Primitives\Microsoft.Toolkit.Uwp.UI.Controls.Primitives.csproj">
<Project>{84ab7dc5-95c9-4cf8-a370-d077e9e9ef1a}</Project>
<Name>Microsoft.Toolkit.Uwp.UI.Controls.Primitives</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Core\Microsoft.Toolkit.Uwp.UI.Controls.Core.csproj">
<Project>{e9faabfb-d726-42c1-83c1-cb46a29fea81}</Project>
<Name>Microsoft.Toolkit.Uwp.UI.Controls</Name>
<Name>Microsoft.Toolkit.Uwp.UI.Controls.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Media\Microsoft.Toolkit.Uwp.UI.Media.csproj">
<Project>{75f9ee44-3efa-47bc-aedd-351b9834a0af}</Project>
Expand Down
120 changes: 23 additions & 97 deletions Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
// TODO Reintroduce graph controls
// using Microsoft.Toolkit.Graph.Converters;
// using Microsoft.Toolkit.Graph.Providers;
using Microsoft.Toolkit.Uwp.Helpers;
using Microsoft.Toolkit.Uwp.Input.GazeInteraction;
using Microsoft.Toolkit.Uwp.SampleApp.Models;
Expand Down Expand Up @@ -626,107 +629,30 @@ public async Task PreparePropertyDescriptorAsync()
private static Type LookForTypeByName(string typeName)
{
// First search locally
var result = System.Type.GetType(typeName);

if (result != null)
if (System.Type.GetType(typeName) is Type systemType)
{
return result;
return systemType;
}

// Search in Windows
var proxyType = VerticalAlignment.Center;
var assembly = proxyType.GetType().GetTypeInfo().Assembly;

foreach (var typeInfo in assembly.ExportedTypes)
var targets = new Type[]
{
if (typeInfo.Name == typeName)
{
return typeInfo;
}
}

// Search in Microsoft.Toolkit.Uwp.UI.Controls
var controlsProxyType = GridSplitter.GridResizeDirection.Auto;
assembly = controlsProxyType.GetType().GetTypeInfo().Assembly;

foreach (var typeInfo in assembly.ExportedTypes)
{
if (typeInfo.Name == typeName)
{
return typeInfo;
}
}

// Search in Microsoft.Toolkit.Graph.Controls
//var graphControlsProxyType = typeof(UserToPersonConverter);
//assembly = graphControlsProxyType.GetTypeInfo().Assembly;

//foreach (var typeInfo in assembly.ExportedTypes)
//{
// if (typeInfo.Name == typeName)
// {
// return typeInfo;
// }
//}

// Search in Microsoft.Toolkit.Uwp.UI.Animations
var animationsProxyType = EasingType.Default;
assembly = animationsProxyType.GetType().GetTypeInfo().Assembly;
foreach (var typeInfo in assembly.ExportedTypes)
{
if (typeInfo.Name == typeName)
{
return typeInfo;
}
}

// Search in Microsoft.Toolkit.Uwp.UI
var uiProxyType = ImageBlendMode.Multiply;
assembly = uiProxyType.GetType().GetTypeInfo().Assembly;
foreach (var typeInfo in assembly.ExportedTypes)
{
if (typeInfo.Name == typeName)
{
return typeInfo;
}
}

// Search in Microsoft.Toolkit.Uwp.Input.GazeInteraction
var gazeType = Interaction.Enabled;
assembly = gazeType.GetType().GetTypeInfo().Assembly;
foreach (var typeInfo in assembly.ExportedTypes)
{
if (typeInfo.Name == typeName)
{
return typeInfo;
}
}

// Search in Microsoft.Toolkit.Uwp.UI.Controls.DataGrid
var dataGridProxyType = DataGridGridLinesVisibility.None;
assembly = dataGridProxyType.GetType().GetTypeInfo().Assembly;

foreach (var typeInfo in assembly.ExportedTypes)
{
if (typeInfo.Name == typeName)
{
return typeInfo;
}
}

// Search in Microsoft.Toolkit.Uwp.UI.Controls.Markdown
var markdownTextBlockType = typeof(MarkdownTextBlock);
assembly = markdownTextBlockType.GetTypeInfo().Assembly;

foreach (var typeInfo in assembly.ExportedTypes)
{
if (typeInfo.Name == typeName)
{
return typeInfo;
}
}

return null;
VerticalAlignment.Center.GetType(), // Windows
StackMode.Replace.GetType(), // Microsoft.Toolkit.Uwp.UI.Controls.Core

// TODO Reintroduce graph controls
// typeof(UserToPersonConverter)) // Search in Microsoft.Toolkit.Graph.Controls
EasingType.Default.GetType(), // Microsoft.Toolkit.Uwp.UI.Animations
ImageBlendMode.Multiply.GetType(), // Search in Microsoft.Toolkit.Uwp.UI
Interaction.Enabled.GetType(), // Microsoft.Toolkit.Uwp.Input.GazeInteraction
DataGridGridLinesVisibility.None.GetType(), // Microsoft.Toolkit.Uwp.UI.Controls.DataGrid
GridSplitter.GridResizeDirection.Auto.GetType(), // Microsoft.Toolkit.Uwp.UI.Controls.Layout
typeof(MarkdownTextBlock), // Microsoft.Toolkit.Uwp.UI.Controls.Markdown
BitmapFileFormat.Bmp.GetType(), // Microsoft.Toolkit.Uwp.UI.Controls.Media
StretchChild.Last.GetType() // Microsoft.Toolkit.Uwp.UI.Controls.Primitivs
};

return targets.SelectMany(t => t.Assembly.ExportedTypes)
.FirstOrDefault(t => t.Name == typeName);
}

private static async Task<string> GetDocsSHA()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles/MSEdgeNotificationStyle.xaml" />
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/Styles/VSCodeNotificationStyle.xaml" />
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.Core/InAppNotification/Styles/MSEdgeNotificationStyle.xaml" />
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.Core/InAppNotification/Styles/VSCodeNotificationStyle.xaml" />
</ResourceDictionary.MergedDictionaries>

<local:DismissCommand x:Key="DismissCommand" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
mc:Ignorable="d">

<Grid>
<controls:MasterDetailsView BackButtonBehavior="Automatic"
<controls:ListDetailsView BackButtonBehavior="Automatic"
ItemsSource="{Binding Emails}"
NoSelectionContent="Select an item to view"
CompactModeThresholdWidth="720">
<controls:MasterDetailsView.ItemTemplate>
<controls:ListDetailsView.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,8">
<TextBlock Text="{Binding From}"
Expand All @@ -27,8 +27,8 @@
MaxLines="1"/>
</StackPanel>
</DataTemplate>
</controls:MasterDetailsView.ItemTemplate>
<controls:MasterDetailsView.DetailsTemplate>
</controls:ListDetailsView.ItemTemplate>
<controls:ListDetailsView.DetailsTemplate>
<DataTemplate>
<RelativePanel Margin="24">
<controls:ImageEx x:Name="FromEllipse"
Expand All @@ -53,8 +53,8 @@
Margin="0,12,0,0"/>
</RelativePanel>
</DataTemplate>
</controls:MasterDetailsView.DetailsTemplate>
<controls:MasterDetailsView.NoSelectionContentTemplate>
</controls:ListDetailsView.DetailsTemplate>
<controls:ListDetailsView.NoSelectionContentTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center">
Expand All @@ -71,8 +71,8 @@
Margin="0,12"/>
</StackPanel>
</DataTemplate>
</controls:MasterDetailsView.NoSelectionContentTemplate>
<controls:MasterDetailsView.MasterCommandBar>
</controls:ListDetailsView.NoSelectionContentTemplate>
<controls:ListDetailsView.ListCommandBar>
<CommandBar>
<AppBarButton Icon="Back" Label="Back"/>
<AppBarButton Icon="Forward" Label="Forward"/>
Expand All @@ -84,14 +84,14 @@
</TextBlock>
</CommandBar.Content>
</CommandBar>
</controls:MasterDetailsView.MasterCommandBar>
<controls:MasterDetailsView.DetailsCommandBar>
</controls:ListDetailsView.ListCommandBar>
<controls:ListDetailsView.DetailsCommandBar>
<CommandBar>
<AppBarButton Icon="MailReply" Label="Reply" />
<AppBarButton Icon="MailReplyAll" Label="Reply All" />
<AppBarButton Icon="MailForward" Label="Forward" />
</CommandBar>
</controls:MasterDetailsView.DetailsCommandBar>
</controls:MasterDetailsView>
</controls:ListDetailsView.DetailsCommandBar>
</controls:ListDetailsView>
</Grid>
</Page>
Loading

0 comments on commit 99f4581

Please sign in to comment.