Merge pull request #82 from microsoft/fixOverlayProblem

Fix for Xaml Island
This commit is contained in:
Clint Rutkas 2020-04-08 21:10:00 -07:00 committed by GitHub
commit b3b7f8b980
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 196 additions and 190 deletions

View file

@ -2,7 +2,6 @@
x:Class="PowerLauncher.UI.LauncherControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PowerLauncher.UI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
@ -10,7 +9,7 @@
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
d:DesignHeight="300"
d:DesignWidth="400">
d:DesignWidth="720">
<UserControl.Resources>
<Style TargetType="AutoSuggestBox" x:Name="CustomStyledAutoSuggestBox">
@ -22,51 +21,44 @@
<Setter.Value>
<ControlTemplate TargetType="AutoSuggestBox">
<Grid x:Name="LayoutRoot">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="Orientation">
<VisualState x:Name="Landscape" />
<VisualState x:Name="Portrait" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBox x:Name="TextBox"
Style="{StaticResource CustomAutoSuggestBoxTextBoxStyle}"
PlaceholderText="{TemplateBinding PlaceholderText}"
Header="{TemplateBinding Header}" Height="72"
Width="{TemplateBinding Width}"
Description="{TemplateBinding Description}"
ScrollViewer.BringIntoViewOnFocusChange="False"
Canvas.ZIndex="0"
Margin="0" VerticalAlignment="Center"
FontSize="24"
DesiredCandidateWindowAlignment="BottomEdge"
UseSystemFocusVisuals="{TemplateBinding UseSystemFocusVisuals}" />
<TextBox
x:Name="TextBox"
Style="{StaticResource CustomAutoSuggestBoxTextBoxStyle}"
PlaceholderText="{TemplateBinding PlaceholderText}"
Header="{TemplateBinding Header}"
Height="72"
Width="{TemplateBinding Width}"
Description="{TemplateBinding Description}"
ScrollViewer.BringIntoViewOnFocusChange="False"
Canvas.ZIndex="0"
Margin="0"
VerticalAlignment="Center"
FontSize="24"
DesiredCandidateWindowAlignment="BottomEdge"
UseSystemFocusVisuals="{TemplateBinding UseSystemFocusVisuals}" />
<Popup x:Name="SuggestionsPopup" Margin="0,24,0,0">
<Border x:Name="SuggestionsContainer">
<ListView x:Name="SuggestionsList"
Background="{ThemeResource AutoSuggestBoxSuggestionsListBackground}"
BorderThickness="{ThemeResource AutoSuggestListBorderThemeThickness}"
BorderBrush="{ThemeResource AutoSuggestBoxSuggestionsListBorderBrush}"
DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
IsItemClickEnabled="True"
ItemTemplate="{TemplateBinding ItemTemplate}"
ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
MaxHeight="{ThemeResource AutoSuggestListMaxHeight}"
Margin="{ThemeResource AutoSuggestListMargin}"
Padding="{ThemeResource AutoSuggestListPadding}" />
<ListView
x:Name="SuggestionsList"
Background="{ThemeResource AutoSuggestBoxSuggestionsListBackground}"
BorderThickness="{ThemeResource AutoSuggestListBorderThemeThickness}"
BorderBrush="{ThemeResource AutoSuggestBoxSuggestionsListBorderBrush}"
DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
IsItemClickEnabled="True"
ItemTemplate="{TemplateBinding ItemTemplate}"
ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
MaxHeight="{ThemeResource AutoSuggestListMaxHeight}"
Margin="{ThemeResource AutoSuggestListMargin}"
Padding="{ThemeResource AutoSuggestListPadding}" />
</Border>
</Popup>
@ -103,10 +95,11 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="ButtonLayoutGrid"
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{ThemeResource TextControlButtonBackground}">
<Grid
x:Name="ButtonLayoutGrid"
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{ThemeResource TextControlButtonBackground}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
@ -329,157 +322,166 @@
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border x:Name="BorderElement"
Grid.Row="1" CornerRadius="4"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
Grid.ColumnSpan="3"
Grid.RowSpan="1" />
<ContentPresenter x:Name="HeaderContentPresenter"
x:DeferLoadStrategy="Lazy"
Visibility="Collapsed"
Grid.Row="0"
Foreground="{ThemeResource TextControlHeaderForeground}"
Margin="{ThemeResource AutoSuggestBoxTopHeaderMargin}"
Grid.ColumnSpan="3"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
FontWeight="Normal"
TextWrapping="Wrap" />
<ScrollViewer x:Name="ContentElement"
Grid.Row="1"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Padding="{TemplateBinding Padding}"
IsTabStop="False" Margin="12,0,0,0"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
ZoomMode="Disabled" />
<ContentControl x:Name="PlaceholderTextContentPresenter"
Grid.Row="1" Opacity="0.6" CornerRadius="4"
Height="42"
Foreground="{ThemeResource TextControlPlaceholderForeground}"
Margin="12,0,0,0"
Padding="{TemplateBinding Padding}"
IsTabStop="False"
Grid.ColumnSpan="3"
VerticalAlignment="Center"
Content="{TemplateBinding PlaceholderText}"
IsHitTestVisible="False" />
<Button x:Name="DeleteButton"
Grid.Row="1"
Style="{StaticResource DeleteButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}"
IsTabStop="False"
Grid.Column="1"
Visibility="Collapsed" Opacity="0"
FontSize="{TemplateBinding FontSize}"
MinWidth="34"
AutomationProperties.AccessibilityView="Raw"
VerticalAlignment="Stretch" />
<Button x:Name="QueryButton"
Grid.Row="1"
Style="{StaticResource QueryButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}"
IsTabStop="False"
Grid.Column="2"
FontSize="{TemplateBinding FontSize}"
MinWidth="34"
Width="{TemplateBinding Height}"
VerticalAlignment="Stretch"
AutomationProperties.AccessibilityView="Raw"/>
<ContentPresenter x:Name="DescriptionPresenter"
Grid.Row="2"
Grid.ColumnSpan="3"
Content="{TemplateBinding Description}"
x:Load="False"
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}"
AutomationProperties.AccessibilityView="Raw" />
<Border
x:Name="BorderElement"
Grid.Row="1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
Grid.ColumnSpan="3"
Grid.RowSpan="1" />
<ContentPresenter
x:Name="HeaderContentPresenter"
x:DeferLoadStrategy="Lazy"
Visibility="Collapsed"
Grid.Row="0"
Foreground="{ThemeResource TextControlHeaderForeground}"
Margin="{ThemeResource AutoSuggestBoxTopHeaderMargin}"
Grid.ColumnSpan="3"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
FontWeight="Normal"
TextWrapping="Wrap" />
<ScrollViewer
x:Name="ContentElement"
Grid.Row="1"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Padding="{TemplateBinding Padding}"
IsTabStop="False"
Margin="12,0,0,0"
CornerRadius="4"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
ZoomMode="Disabled" />
<ContentControl
x:Name="PlaceholderTextContentPresenter"
Grid.Row="1"
Opacity="0.6"
Height="42"
Foreground="{ThemeResource TextControlPlaceholderForeground}"
Margin="12,0,0,0"
Padding="{TemplateBinding Padding}"
IsTabStop="False"
Grid.ColumnSpan="3"
VerticalAlignment="Center"
Content="{TemplateBinding PlaceholderText}"
IsHitTestVisible="False" />
<Button
x:Name="DeleteButton"
Grid.Row="1"
Style="{StaticResource DeleteButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}"
IsTabStop="False"
Grid.Column="1"
Visibility="Collapsed" Opacity="0"
FontSize="{TemplateBinding FontSize}"
MinWidth="34"
AutomationProperties.AccessibilityView="Raw"
VerticalAlignment="Stretch" />
<Button
x:Name="QueryButton"
Grid.Row="1"
Style="{StaticResource QueryButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}"
IsTabStop="False"
Grid.Column="2"
FontSize="{TemplateBinding FontSize}"
MinWidth="34"
Width="{TemplateBinding Height}"
VerticalAlignment="Stretch"
AutomationProperties.AccessibilityView="Raw"/>
<ContentPresenter
x:Name="DescriptionPresenter"
Grid.Row="2"
Grid.ColumnSpan="3"
Content="{TemplateBinding Description}"
x:Load="False"
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}"
AutomationProperties.AccessibilityView="Raw" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ThemeShadow x:Name="ShellBarShadow"/>
</UserControl.Resources>
<Grid>
<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}"
Width="720" ItemsSource="{Binding Results.Results}">
<AutoSuggestBox.QueryIcon>
<SymbolIcon Symbol="Find"/>
</AutoSuggestBox.QueryIcon>
<AutoSuggestBox.ItemTemplate>
<DataTemplate >
<Grid Height="72" Width="690" Background="Transparent" RowSpacing="0">
<Grid
x:Name="PowerBar"
Background="{StaticResource BackdropAcrylicBrush}"
Height="72"
Translation="0,0,16"
VerticalAlignment="Top">
<AutoSuggestBox
x:Name="SearchBox"
x:FieldModifier="public"
PlaceholderText="Launch an app"
FontSize="24"
Style="{StaticResource CustomStyledAutoSuggestBox}"
ItemsSource="{Binding Results.Results}">
<AutoSuggestBox.QueryIcon>
<SymbolIcon Symbol="Find"/>
</AutoSuggestBox.QueryIcon>
<AutoSuggestBox.ItemTemplate>
<DataTemplate >
<Grid Height="72" Width="690" Background="Transparent" RowSpacing="0">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="PointerEntered">
<Core:CallMethodAction TargetObject="{Binding ElementName=ShowActionButtons}" MethodName="StartAnimation"/>
</Core:EventTriggerBehavior>
<Core:EventTriggerBehavior EventName="PointerExited">
<Core:CallMethodAction TargetObject="{Binding ElementName=HideActionsButtons}" MethodName="StartAnimation"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions >
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<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= "{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>
<Core:EventTriggerBehavior EventName="PointerEntered">
<Core:CallMethodAction TargetObject="{Binding ElementName=ShowActionButtons}" MethodName="StartAnimation"/>
</Core:EventTriggerBehavior>
<Core:EventTriggerBehavior EventName="PointerExited">
<Core:CallMethodAction TargetObject="{Binding ElementName=HideActionsButtons}" MethodName="StartAnimation"/>
</Core:EventTriggerBehavior>
<ToolkitBehaviors:Fade x:Name="ShowActionButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="1" />
<ToolkitBehaviors:Fade x:Name="HideActionsButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="0" />
</Interactivity:Interaction.Behaviors>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="64" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions >
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<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= "{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" />
<ToolkitBehaviors:Fade x:Name="HideActionsButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="0" />
</Interactivity:Interaction.Behaviors>
<Button Background="Transparent" Height="42" Width="42" Grid.Column="1" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
<ToolTipService.ToolTip>
<TextBlock Text="Run as administrator"/>
</ToolTipService.ToolTip>
<Button.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE7EF;"/>
</Button.Content>
</Button>
<Button Background="Transparent" Height="42" Width="42" Grid.Column="1" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
<ToolTipService.ToolTip>
<TextBlock Text="Open file location"/>
</ToolTipService.ToolTip>
<Button.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE838;"/>
</Button.Content>
</Button>
<Button Background="Transparent" Height="42" Width="42" Grid.Column="1" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
<ToolTipService.ToolTip>
<TextBlock Text="Open in console"/>
</ToolTipService.ToolTip>
<Button.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE756;"/>
</Button.Content>
</Button>
</StackPanel>
</Grid>
</DataTemplate>
</AutoSuggestBox.ItemTemplate>
</AutoSuggestBox>
</Grid>
<Button Background="Transparent" Height="42" Width="42" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
<ToolTipService.ToolTip>
<TextBlock Text="Run as administrator"/>
</ToolTipService.ToolTip>
<Button.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE7EF;"/>
</Button.Content>
</Button>
<Button Background="Transparent" Height="42" Width="42" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
<ToolTipService.ToolTip>
<TextBlock Text="Open file location"/>
</ToolTipService.ToolTip>
<Button.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE838;"/>
</Button.Content>
</Button>
<Button Background="Transparent" Height="42" Width="42" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
<ToolTipService.ToolTip>
<TextBlock Text="Open in console"/>
</ToolTipService.ToolTip>
<Button.Content>
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE756;"/>
</Button.Content>
</Button>
</StackPanel>
</Grid>
</DataTemplate>
</AutoSuggestBox.ItemTemplate>
</AutoSuggestBox>
</Grid>
</UserControl>

View file

@ -6,8 +6,7 @@ namespace PowerLauncher.UI
{
public LauncherControl()
{
this.InitializeComponent();
ShellBarShadow.Receivers.Add(ShadowReceiverGrid);
InitializeComponent();
}
}
}

View file

@ -15,7 +15,6 @@
WindowStartupLocation="Manual"
AllowDrop="True"
ShowInTaskbar="False"
Style="{DynamicResource WindowStyle}"
Icon="Images/app.png"
AllowsTransparency="True"
Loaded="OnLoaded"
@ -25,10 +24,16 @@
LocationChanged="OnLocationChanged"
Deactivated="OnDeactivated"
PreviewKeyDown="OnKeyDown"
Background="Transparent"
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
d:DataContext="{d:DesignInstance vm:MainViewModel}">
<xaml:WindowsXamlHost InitialTypeName="PowerLauncher.UI.LauncherControl" ChildChanged="WindowsXamlHost_ChildChanged" />
<Border Margin="10" Background="#fff" BorderBrush="#ccc" BorderThickness="1" CornerRadius="4" Padding="4" Width="720" >
<Border.Effect>
<DropShadowEffect BlurRadius="12" Opacity="0.3" ShadowDepth="4" />
</Border.Effect>
<xaml:WindowsXamlHost InitialTypeName="PowerLauncher.UI.LauncherControl" ChildChanged="WindowsXamlHost_ChildChanged" />
</Border>
<Window.InputBindings>
<KeyBinding Key="Escape" Command="{Binding EscCommand}"></KeyBinding>
<KeyBinding Key="Escape" Command="{Binding EscCommand}" />
</Window.InputBindings>
</Window>