[Launcher] Fluent UX enhancements (#2477)

* Removed unnecessary styling resources.
Fixed searchbox overlay.
Fixed a bug where the command buttons would fall of the list

* Fixed a bug where the app icon could overlap the title/path textblocks

* Consistent background / border color

* Tweaked shadow, background color now theme depended
This commit is contained in:
Niels Laute
2020-04-29 19:33:58 +02:00
committed by GitHub
parent 371926b202
commit 26b3185933
5 changed files with 58 additions and 495 deletions

View File

@@ -37,7 +37,7 @@
BorderThickness="4"
CornerRadius="4">
<Border.Effect>
<DropShadowEffect BlurRadius="12" Opacity="0.4" ShadowDepth="0" />
<DropShadowEffect BlurRadius="16" Opacity="0.8" ShadowDepth="0" />
</Border.Effect>
<xaml:WindowsXamlHost
InitialTypeName="PowerLauncher.UI.LauncherControl"
@@ -51,7 +51,7 @@
CornerRadius="4"
Visibility="{Binding Results.Visbility}">
<Border.Effect>
<DropShadowEffect BlurRadius="12" Opacity="0.4" ShadowDepth="0" />
<DropShadowEffect BlurRadius="16" Opacity="0.8" ShadowDepth="0" />
</Border.Effect>
<xaml:WindowsXamlHost
InitialTypeName="PowerLauncher.UI.ResultList"

View File

@@ -154,8 +154,8 @@ namespace PowerLauncher
_launcher = (PowerLauncher.UI.LauncherControl)host.Child;
_launcher.DataContext = _viewModel;
_launcher.KeyDown += _launcher_KeyDown;
_launcher.TextBox.TextChanging += QueryTextBox_TextChanging;
_launcher.TextBox.Loaded += TextBox_Loaded;
_launcher.QueryTextBox.TextChanging += QueryTextBox_TextChanging;
_launcher.QueryTextBox.Loaded += TextBox_Loaded;
_launcher.PropertyChanged += UserControl_PropertyChanged;
_viewModel.PropertyChanged += (o, e) =>
{
@@ -172,16 +172,16 @@ namespace PowerLauncher
}
// to select the text so that the user can continue to type
if(!String.IsNullOrEmpty(_launcher.TextBox.Text))
if(!String.IsNullOrEmpty(_launcher.QueryTextBox.Text))
{
_launcher.TextBox.SelectAll();
_launcher.QueryTextBox.SelectAll();
}
}
}
else if(e.PropertyName == nameof(MainViewModel.SystemQueryText))
{
this._isTextSetProgramatically = true;
_launcher.TextBox.Text = _viewModel.SystemQueryText;
_launcher.QueryTextBox.Text = _viewModel.SystemQueryText;
}
};
}
@@ -319,31 +319,7 @@ namespace PowerLauncher
// To populate the AutoCompleteTextBox as soon as the selection is changed or set.
// Setting it here instead of when the text is changed as there is a delay in executing the query and populating the result
_launcher.AutoCompleteTextBox.PlaceholderText = ListView_FirstItem(_viewModel.QueryText);
}
private void ResultsList_ItemClick(object sender, ItemClickEventArgs e)
{
ResultViewModel result = e?.ClickedItem as ResultViewModel;
if(result != null)
{
_viewModel.Results.SelectedItem = result;
_viewModel.OpenResultCommand.Execute(null);
}
}
private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
if (args != null && args.ChosenSuggestion != null)
{
ResultViewModel result = (ResultViewModel)args.ChosenSuggestion;
if (result != null)
{
_viewModel.Results.SelectedItem = result;
_viewModel.OpenResultCommand.Execute(null);
}
}
_launcher.AutoCompleteTextBlock.Text = ListView_FirstItem(_viewModel.QueryText);
}
private const int millisecondsToWait = 200;
@@ -373,18 +349,18 @@ namespace PowerLauncher
if(this._isTextSetProgramatically)
{
this._launcher.TextBox.TextChanged += QueryTextBox_TextChangedProgramatically;
this._launcher.QueryTextBox.TextChanged += QueryTextBox_TextChangedProgramatically;
}
else
{
this._launcher.TextBox.TextChanged += QueryTextBox_TextChangedByUserInput;
this._launcher.QueryTextBox.TextChanged += QueryTextBox_TextChangedByUserInput;
}
}
private void ClearAllQueryTextChangedHanlders()
{
this._launcher.TextBox.TextChanged -= QueryTextBox_TextChangedProgramatically;
this._launcher.TextBox.TextChanged -= QueryTextBox_TextChangedByUserInput;
this._launcher.QueryTextBox.TextChanged -= QueryTextBox_TextChangedProgramatically;
this._launcher.QueryTextBox.TextChanged -= QueryTextBox_TextChangedByUserInput;
}
private void QueryTextBox_TextChangedProgramatically(object sender, Windows.UI.Xaml.Controls.TextChangedEventArgs e)
@@ -402,7 +378,7 @@ namespace PowerLauncher
//To clear the auto-suggest immediately instead of waiting for selection changed
if (text == String.Empty)
{
_launcher.AutoCompleteTextBox.PlaceholderText = String.Empty;
_launcher.AutoCompleteTextBlock.Text = String.Empty;
}
_viewModel.QueryText = text;
@@ -424,7 +400,7 @@ namespace PowerLauncher
}
}
private void WindowsXamlHost_PreviewMouseDown(object sender, MouseButtonEventArgs e)
private void WindowsXamlHost_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
// if (sender != null && e.OriginalSource != null)
// {