Skip to content

Commit bd1ded7

Browse files
committed
Mica and searchbox
1 parent 58eead7 commit bd1ded7

File tree

6 files changed

+18
-39
lines changed

6 files changed

+18
-39
lines changed

CommunityToolkit.App.Shared/App.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
3939
currentWindow = new Window();
4040
currentWindow.Title = "Toolkit Labs Gallery";
4141
currentWindow.AppWindow.SetIcon("Assets/Icon.ico");
42+
currentWindow.SystemBackdrop = new MicaBackdrop();
4243
#if ALL_SAMPLES
4344
currentWindow.AppWindow.TitleBar.ExtendsContentIntoTitleBar = true;
4445
currentWindow.AppWindow.TitleBar.ButtonBackgroundColor = Microsoft.UI.Colors.Transparent;

CommunityToolkit.App.Shared/CommunityToolkit.App.Shared.projitems

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<Compile Include="$(MSBuildThisFileDirectory)Controls\TitleBar\TitleBar.Properties.cs" />
3131
<Compile Include="$(MSBuildThisFileDirectory)Converters\StringToUriConverter.cs" />
3232
<Compile Include="$(MSBuildThisFileDirectory)DocOrSampleTemplateSelector.cs" />
33-
<Compile Include="$(MSBuildThisFileDirectory)Helpers\BackgroundHelper.cs" />
3433
<Compile Include="$(MSBuildThisFileDirectory)Helpers\IconHelper.cs" />
3534
<Compile Include="$(MSBuildThisFileDirectory)Helpers\NavigationViewHelper.cs" />
3635
<Compile Include="$(MSBuildThisFileDirectory)Pages\GettingStartedPage.xaml.cs">

CommunityToolkit.App.Shared/Helpers/BackgroundHelper.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

CommunityToolkit.App.Shared/Pages/Shell.xaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
1+
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
22
<Page x:Class="CommunityToolkit.App.Shared.Pages.Shell"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -26,14 +26,14 @@
2626
UriSource="ms-appx:///Assets/AppTitleBar.png" />
2727
</controls:TitleBar.Icon>
2828
<controls:TitleBar.Content>
29-
<win:AutoSuggestBox x:Name="searchBox"
30-
win:AutomationProperties.Name="Search"
31-
ItemTemplate="{StaticResource ControlItemAutoSuggestBoxTemplate}"
32-
PlaceholderText="Search Labs"
33-
QueryIcon="Find"
34-
QuerySubmitted="searchBox_QuerySubmitted"
35-
TextChanged="searchBox_TextChanged"
36-
UpdateTextOnSelect="False" />
29+
<AutoSuggestBox x:Name="searchBox"
30+
win:AutomationProperties.Name="Search"
31+
ItemTemplate="{StaticResource ControlItemAutoSuggestBoxTemplate}"
32+
PlaceholderText="Search Labs"
33+
QueryIcon="Find"
34+
QuerySubmitted="searchBox_QuerySubmitted"
35+
TextChanged="searchBox_TextChanged"
36+
UpdateTextOnSelect="False" />
3737
</controls:TitleBar.Content>
3838
</controls:TitleBar>
3939
<muxc:NavigationView x:Name="NavView"

CommunityToolkit.App.Shared/Pages/Shell.xaml.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using CommunityToolkit.App.Shared.Renderers;
66
using CommunityToolkit.Tooling.SampleGen.Metadata;
77
using CommunityToolkit.App.Shared.Helpers;
8+
using Microsoft.UI.Xaml.Controls;
89

910
namespace CommunityToolkit.App.Shared.Pages;
1011

@@ -20,7 +21,9 @@ public Shell()
2021
{
2122
this.InitializeComponent();
2223
#if WINAPPSDK
23-
appTitleBar.Window = App.currentWindow;
24+
appTitleBar.Window = App.currentWindow;
25+
#else
26+
BackdropMaterial.SetApplyToRootOrPageBackground(this, true);
2427
#endif
2528
Current = this;
2629
}
@@ -31,7 +34,6 @@ public Shell()
3134
protected override void OnNavigatedTo(NavigationEventArgs e)
3235
{
3336
samplePages = e.Parameter as IEnumerable<ToolkitFrontMatter>;
34-
BackgroundHelper.SetBackground(this);
3537
SetupNavigationMenu();
3638
base.OnNavigatedTo(e);
3739
}
@@ -149,8 +151,6 @@ public void EnsureNavigationSelection(string? FilePath)
149151
}
150152
}
151153

152-
//// See AutoSuggestBox issue for WASM https://github.com/unoplatform/uno/issues/7778
153-
#if !HAS_UNO
154154
private void searchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
155155
{
156156
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
@@ -182,7 +182,6 @@ private void searchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuery
182182
return;
183183
}
184184
}
185-
#endif
186185

187186
private void TitleBar_PaneButtonClick(object sender, RoutedEventArgs e)
188187
{

CommunityToolkit.App.Shared/Pages/TabbedPage.xaml.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using CommunityToolkit.Tooling.SampleGen.Metadata;
66
using CommunityToolkit.App.Shared.Helpers;
7+
using Microsoft.UI.Xaml.Controls;
78

89
#if !WINAPPSDK
910
using Windows.UI.Xaml;
@@ -34,9 +35,10 @@ public TabbedPage()
3435
{
3536
this.InitializeComponent();
3637
#if WINAPPSDK
37-
appTitleBar.Window = App.currentWindow;
38+
appTitleBar.Window = App.currentWindow;
39+
#else
40+
BackdropMaterial.SetApplyToRootOrPageBackground(this, true);
3841
#endif
39-
BackgroundHelper.SetBackground(this);
4042
}
4143

4244

0 commit comments

Comments
 (0)