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
3 changed files with 196 additions and 190 deletions

View File

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

View File

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

View File

@@ -15,7 +15,6 @@
WindowStartupLocation="Manual" WindowStartupLocation="Manual"
AllowDrop="True" AllowDrop="True"
ShowInTaskbar="False" ShowInTaskbar="False"
Style="{DynamicResource WindowStyle}"
Icon="Images/app.png" Icon="Images/app.png"
AllowsTransparency="True" AllowsTransparency="True"
Loaded="OnLoaded" Loaded="OnLoaded"
@@ -25,10 +24,16 @@
LocationChanged="OnLocationChanged" LocationChanged="OnLocationChanged"
Deactivated="OnDeactivated" Deactivated="OnDeactivated"
PreviewKeyDown="OnKeyDown" PreviewKeyDown="OnKeyDown"
Background="Transparent"
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
d:DataContext="{d:DesignInstance vm:MainViewModel}"> d:DataContext="{d:DesignInstance vm:MainViewModel}">
<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" /> <xaml:WindowsXamlHost InitialTypeName="PowerLauncher.UI.LauncherControl" ChildChanged="WindowsXamlHost_ChildChanged" />
</Border>
<Window.InputBindings> <Window.InputBindings>
<KeyBinding Key="Escape" Command="{Binding EscCommand}"></KeyBinding> <KeyBinding Key="Escape" Command="{Binding EscCommand}" />
</Window.InputBindings> </Window.InputBindings>
</Window> </Window>