Rectyfying title display

This commit is contained in:
Divyansh
2020-04-06 17:38:48 -07:00
parent 553922bef6
commit dc0715dc2a
2 changed files with 4 additions and 18 deletions

View File

@@ -416,8 +416,7 @@
<Grid x:Name="ShadowReceiverGrid"/>
<Grid x:Name="PowerBar" CornerRadius="4" Height="72" Background="{StaticResource BackdropAcrylicBrush}" Translation="0,0,16" Shadow="{StaticResource ShellBarShadow}" Margin="12" VerticalAlignment="Top" HorizontalAlignment="Center" MinWidth="240">
<AutoSuggestBox x:Name="SearchBox" x:FieldModifier="public" PlaceholderText="Launch an app" FontSize="24" Style="{StaticResource CustomStyledAutoSuggestBox}"
MinWidth="720"
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Results.Results}">
MinWidth="720" ItemsSource="{Binding Results.Results}" TextMemberPath="Title">
<AutoSuggestBox.QueryIcon>
<SymbolIcon Symbol="Find"/>
</AutoSuggestBox.QueryIcon>
@@ -444,7 +443,7 @@
<Image x:Name="AppIcon" Height="36" Margin="8,0,0,0" Grid.RowSpan="2" HorizontalAlignment="Left" Source="{Binding Result.IcoPath}" />
<TextBlock x:Name="Title" Grid.Column="1" Text="{Binding Result.Title}" FontWeight="SemiBold" FontSize="20" VerticalAlignment="Bottom"/>
<TextBlock x:Name="Path" Grid.Column="1" Text="C:\Program Files\WindowsApps\Microsoft\Folder " Grid.Row="1" Opacity="0.6" VerticalAlignment="Top"/>
<TextBlock x:Name="Path" Grid.Column="1" Text= "{Binding Result.SubTitle}" Grid.Row="1" Opacity="0.6" VerticalAlignment="Top"/>
<StackPanel Orientation="Horizontal" Opacity="0" HorizontalAlignment="Right" Grid.RowSpan="2" Grid.Column="1">
<Interactivity:Interaction.Behaviors>
<ToolkitBehaviors:Fade x:Name="ShowActionButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="1" />
@@ -477,7 +476,7 @@
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</AutoSuggestBox.ItemTemplate>
</AutoSuggestBox>

View File

@@ -261,7 +261,6 @@ namespace PowerLauncher
_launcher = (PowerLauncher.UI.LauncherControl)host.Child;
_launcher.DataContext = _viewModel;
_launcher.SearchBox.TextChanged += QueryTextBox_TextChanged;
_launcher.SearchBox.SuggestionChosen += AutoSuggestBox_SuggestionChosen;
_launcher.SearchBox.QuerySubmitted += AutoSuggestBox_QuerySubmitted;
_launcher.SearchBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);
_viewModel.PropertyChanged += (o, e) =>
@@ -283,15 +282,6 @@ namespace PowerLauncher
};
}
private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
{
if(args != null && args.SelectedItem != null)
{
ResultViewModel result = (ResultViewModel)args.SelectedItem;
sender.Text = result.Result.Title;
}
}
private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
{
if (args != null && args.ChosenSuggestion != null)
@@ -305,10 +295,7 @@ namespace PowerLauncher
{
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
{
if (_viewModel.QueryTextCursorMovedToEnd)
{
_viewModel.QueryTextCursorMovedToEnd = false;
}
_viewModel.QueryText = sender.Text;
}
}
}