diff --git a/WinUIGallery/Assets/HomeHeaderTiles/accessibility_tile.png b/WinUIGallery/Assets/HomeHeaderTiles/accessibility_tile.png new file mode 100644 index 000000000..d31ce4a37 Binary files /dev/null and b/WinUIGallery/Assets/HomeHeaderTiles/accessibility_tile.png differ diff --git a/WinUIGallery/Assets/gettingStarted.png b/WinUIGallery/Assets/HomeHeaderTiles/gettingStarted.png similarity index 100% rename from WinUIGallery/Assets/gettingStarted.png rename to WinUIGallery/Assets/HomeHeaderTiles/gettingStarted.png diff --git a/WinUIGallery/Assets/githubTile.png b/WinUIGallery/Assets/HomeHeaderTiles/githubTile.png similarity index 100% rename from WinUIGallery/Assets/githubTile.png rename to WinUIGallery/Assets/HomeHeaderTiles/githubTile.png diff --git a/WinUIGallery/Assets/style-1x.png b/WinUIGallery/Assets/HomeHeaderTiles/style-1x.png similarity index 100% rename from WinUIGallery/Assets/style-1x.png rename to WinUIGallery/Assets/HomeHeaderTiles/style-1x.png diff --git a/WinUIGallery/Assets/template_studio.png b/WinUIGallery/Assets/HomeHeaderTiles/template_studio.png similarity index 100% rename from WinUIGallery/Assets/template_studio.png rename to WinUIGallery/Assets/HomeHeaderTiles/template_studio.png diff --git a/WinUIGallery/Assets/HomeHeaderTiles/toolkit.png b/WinUIGallery/Assets/HomeHeaderTiles/toolkit.png new file mode 100644 index 000000000..76d1a4856 Binary files /dev/null and b/WinUIGallery/Assets/HomeHeaderTiles/toolkit.png differ diff --git a/WinUIGallery/ContentIncludes.props b/WinUIGallery/ContentIncludes.props index 52d736731..e6b97def6 100644 --- a/WinUIGallery/ContentIncludes.props +++ b/WinUIGallery/ContentIncludes.props @@ -197,10 +197,12 @@ - - - - + + + + + + diff --git a/WinUIGallery/ControlPages/DataGridPage.xaml.cs b/WinUIGallery/ControlPages/DataGridPage.xaml.cs index 49d8d9803..1f851eb60 100644 --- a/WinUIGallery/ControlPages/DataGridPage.xaml.cs +++ b/WinUIGallery/ControlPages/DataGridPage.xaml.cs @@ -1,6 +1,7 @@ -using System; +using System; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using Windows.System; namespace AppUIBasics.ControlPages { @@ -13,14 +14,18 @@ public DataGridPage() private async void LaunchToolkitButton_Click(object sender, RoutedEventArgs e) { - // Set the recommended app - var options = new Windows.System.LauncherOptions - { - PreferredApplicationPackageFamilyName = "Microsoft.UWPCommunityToolkitSampleApp_8wekyb3d8bbwe", - PreferredApplicationDisplayName = "Windows Community Toolkit" - }; + // Either open the app if already instealled or the Microsoft Store + + var isToolkitAvailable = await Windows.System.Launcher.QueryUriSupportAsync(new Uri("uwpct://controls?sample=datagrid"), Windows.System.LaunchQuerySupportType.Uri); - await Windows.System.Launcher.LaunchUriAsync(new Uri("uwpct://controls?sample=datagrid"), options); + if (isToolkitAvailable == LaunchQuerySupportStatus.Available) + { + await Windows.System.Launcher.LaunchUriAsync(new Uri("uwpct://controls?sample=datagrid")); + } + else + { + await Windows.System.Launcher.LaunchUriAsync(new Uri(@"ms-windows-store://pdp/?ProductId=9NBLGGH4TLCQ")); + } } } } diff --git a/WinUIGallery/Controls/HeaderTile.xaml b/WinUIGallery/Controls/HeaderTile.xaml index 1cb865405..65e260001 100644 --- a/WinUIGallery/Controls/HeaderTile.xaml +++ b/WinUIGallery/Controls/HeaderTile.xaml @@ -7,7 +7,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - + @@ -32,10 +32,10 @@ - + - + - + diff --git a/WinUIGallery/Controls/TileGallery.xaml b/WinUIGallery/Controls/TileGallery.xaml new file mode 100644 index 000000000..739582bd0 --- /dev/null +++ b/WinUIGallery/Controls/TileGallery.xaml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WinUIGallery/Controls/TileGallery.xaml.cs b/WinUIGallery/Controls/TileGallery.xaml.cs new file mode 100644 index 000000000..4495c2525 --- /dev/null +++ b/WinUIGallery/Controls/TileGallery.xaml.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation and Contributors. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; +using Windows.Foundation; +using Windows.Foundation.Collections; + +namespace AppUIBasics.Controls +{ + public sealed partial class TileGallery : UserControl + { + public TileGallery() + { + this.InitializeComponent(); + } + + private void scroller_ViewChanging(object sender, ScrollViewerViewChangingEventArgs e) + { + if (e.FinalView.HorizontalOffset < 1) + { + ScrollBackBtn.Visibility = Visibility.Collapsed; + } + else if (e.FinalView.HorizontalOffset > 1) + { + ScrollBackBtn.Visibility = Visibility.Visible; + } + + if (e.FinalView.HorizontalOffset > scroller.ScrollableWidth - 1) + { + ScrollForwardBtn.Visibility = Visibility.Collapsed; + } + else if (e.FinalView.HorizontalOffset < scroller.ScrollableWidth - 1) + { + ScrollForwardBtn.Visibility = Visibility.Visible; + } + } + + private void ScrollBackBtn_Click(object sender, RoutedEventArgs e) + { + scroller.ChangeView(scroller.HorizontalOffset - scroller.ViewportWidth, null, null); + } + + private void ScrollForwardBtn_Click(object sender, RoutedEventArgs e) + { + scroller.ChangeView(scroller.HorizontalOffset + scroller.ViewportWidth, null, null); + } + + private void scroller_SizeChanged(object sender, SizeChangedEventArgs e) + { + UpdateScrollButtonsVisibility(); + } + + private void UpdateScrollButtonsVisibility() + { + if (scroller.ScrollableWidth > 0) + { + ScrollForwardBtn.Visibility = Visibility.Visible; + } + else + { + ScrollForwardBtn.Visibility = Visibility.Collapsed; + } + } + } +} diff --git a/WinUIGallery/NewControlsPage.xaml b/WinUIGallery/NewControlsPage.xaml index 7a6e81044..fd4f3dc36 100644 --- a/WinUIGallery/NewControlsPage.xaml +++ b/WinUIGallery/NewControlsPage.xaml @@ -112,14 +112,7 @@ Style="{StaticResource SubtitleTextBlockStyle}" Text="{StaticResource WinUIVersion}"/> - - - - - - - - + diff --git a/WinUIGallery/WinUIGallery.DesktopWap.csproj b/WinUIGallery/WinUIGallery.DesktopWap.csproj index a66afa357..02c5c92b8 100644 --- a/WinUIGallery/WinUIGallery.DesktopWap.csproj +++ b/WinUIGallery/WinUIGallery.DesktopWap.csproj @@ -94,5 +94,4 @@ -