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,51 +21,44 @@
<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> Style="{StaticResource CustomAutoSuggestBoxTextBoxStyle}"
PlaceholderText="{TemplateBinding PlaceholderText}"
<Grid.RowDefinitions> Header="{TemplateBinding Header}"
<RowDefinition Height="*" /> Height="72"
</Grid.RowDefinitions> Width="{TemplateBinding Width}"
Description="{TemplateBinding Description}"
<TextBox x:Name="TextBox" ScrollViewer.BringIntoViewOnFocusChange="False"
Style="{StaticResource CustomAutoSuggestBoxTextBoxStyle}" Canvas.ZIndex="0"
PlaceholderText="{TemplateBinding PlaceholderText}" Margin="0"
Header="{TemplateBinding Header}" Height="72" VerticalAlignment="Center"
Width="{TemplateBinding Width}" FontSize="24"
Description="{TemplateBinding Description}" DesiredCandidateWindowAlignment="BottomEdge"
ScrollViewer.BringIntoViewOnFocusChange="False" UseSystemFocusVisuals="{TemplateBinding UseSystemFocusVisuals}" />
Canvas.ZIndex="0"
Margin="0" VerticalAlignment="Center"
FontSize="24"
DesiredCandidateWindowAlignment="BottomEdge"
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
Background="{ThemeResource AutoSuggestBoxSuggestionsListBackground}" x:Name="SuggestionsList"
BorderThickness="{ThemeResource AutoSuggestListBorderThemeThickness}" Background="{ThemeResource AutoSuggestBoxSuggestionsListBackground}"
BorderBrush="{ThemeResource AutoSuggestBoxSuggestionsListBorderBrush}" BorderThickness="{ThemeResource AutoSuggestListBorderThemeThickness}"
DisplayMemberPath="{TemplateBinding DisplayMemberPath}" BorderBrush="{ThemeResource AutoSuggestBoxSuggestionsListBorderBrush}"
IsItemClickEnabled="True" DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
ItemTemplate="{TemplateBinding ItemTemplate}" IsItemClickEnabled="True"
ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}" ItemTemplate="{TemplateBinding ItemTemplate}"
ItemContainerStyle="{TemplateBinding ItemContainerStyle}" ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
MaxHeight="{ThemeResource AutoSuggestListMaxHeight}" ItemContainerStyle="{TemplateBinding ItemContainerStyle}"
Margin="{ThemeResource AutoSuggestListMargin}" MaxHeight="{ThemeResource AutoSuggestListMaxHeight}"
Padding="{ThemeResource AutoSuggestListPadding}" /> Margin="{ThemeResource AutoSuggestListMargin}"
Padding="{ThemeResource AutoSuggestListPadding}" />
</Border> </Border>
</Popup> </Popup>
@@ -103,10 +95,11 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="Button"> <ControlTemplate TargetType="Button">
<Grid x:Name="ButtonLayoutGrid" <Grid
BorderBrush="{ThemeResource TextControlButtonBorderBrush}" x:Name="ButtonLayoutGrid"
BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
Background="{ThemeResource TextControlButtonBackground}"> BorderThickness="{TemplateBinding BorderThickness}"
Background="{ThemeResource TextControlButtonBackground}">
<VisualStateManager.VisualStateGroups> <VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates"> <VisualStateGroup x:Name="CommonStates">
@@ -329,157 +322,166 @@
<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
<ContentPresenter x:Name="HeaderContentPresenter" x:Name="HeaderContentPresenter"
x:DeferLoadStrategy="Lazy" x:DeferLoadStrategy="Lazy"
Visibility="Collapsed" Visibility="Collapsed"
Grid.Row="0" Grid.Row="0"
Foreground="{ThemeResource TextControlHeaderForeground}" Foreground="{ThemeResource TextControlHeaderForeground}"
Margin="{ThemeResource AutoSuggestBoxTopHeaderMargin}" Margin="{ThemeResource AutoSuggestBoxTopHeaderMargin}"
Grid.ColumnSpan="3" Grid.ColumnSpan="3"
Content="{TemplateBinding Header}" Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplate="{TemplateBinding HeaderTemplate}"
FontWeight="Normal" FontWeight="Normal"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
<ScrollViewer x:Name="ContentElement" <ScrollViewer
Grid.Row="1" x:Name="ContentElement"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" Grid.Row="1"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
IsTabStop="False" Margin="12,0,0,0" IsTabStop="False"
VerticalAlignment="Center" Margin="12,0,0,0"
AutomationProperties.AccessibilityView="Raw" CornerRadius="4"
ZoomMode="Disabled" /> VerticalAlignment="Center"
<ContentControl x:Name="PlaceholderTextContentPresenter" AutomationProperties.AccessibilityView="Raw"
Grid.Row="1" Opacity="0.6" CornerRadius="4" ZoomMode="Disabled" />
Height="42" <ContentControl
Foreground="{ThemeResource TextControlPlaceholderForeground}" x:Name="PlaceholderTextContentPresenter"
Margin="12,0,0,0" Grid.Row="1"
Padding="{TemplateBinding Padding}" Opacity="0.6"
IsTabStop="False" Height="42"
Grid.ColumnSpan="3" Foreground="{ThemeResource TextControlPlaceholderForeground}"
VerticalAlignment="Center" Margin="12,0,0,0"
Content="{TemplateBinding PlaceholderText}" Padding="{TemplateBinding Padding}"
IsHitTestVisible="False" /> IsTabStop="False"
<Button x:Name="DeleteButton" Grid.ColumnSpan="3"
Grid.Row="1" VerticalAlignment="Center"
Style="{StaticResource DeleteButtonStyle}" Content="{TemplateBinding PlaceholderText}"
BorderThickness="{TemplateBinding BorderThickness}" IsHitTestVisible="False" />
IsTabStop="False" <Button
Grid.Column="1" x:Name="DeleteButton"
Visibility="Collapsed" Opacity="0" Grid.Row="1"
FontSize="{TemplateBinding FontSize}" Style="{StaticResource DeleteButtonStyle}"
MinWidth="34" BorderThickness="{TemplateBinding BorderThickness}"
AutomationProperties.AccessibilityView="Raw" IsTabStop="False"
VerticalAlignment="Stretch" /> Grid.Column="1"
<Button x:Name="QueryButton" Visibility="Collapsed" Opacity="0"
Grid.Row="1" FontSize="{TemplateBinding FontSize}"
Style="{StaticResource QueryButtonStyle}" MinWidth="34"
BorderThickness="{TemplateBinding BorderThickness}" AutomationProperties.AccessibilityView="Raw"
IsTabStop="False" VerticalAlignment="Stretch" />
Grid.Column="2" <Button
FontSize="{TemplateBinding FontSize}" x:Name="QueryButton"
MinWidth="34" Grid.Row="1"
Width="{TemplateBinding Height}" Style="{StaticResource QueryButtonStyle}"
VerticalAlignment="Stretch" BorderThickness="{TemplateBinding BorderThickness}"
AutomationProperties.AccessibilityView="Raw"/> IsTabStop="False"
<ContentPresenter x:Name="DescriptionPresenter" Grid.Column="2"
Grid.Row="2" FontSize="{TemplateBinding FontSize}"
Grid.ColumnSpan="3" MinWidth="34"
Content="{TemplateBinding Description}" Width="{TemplateBinding Height}"
x:Load="False" VerticalAlignment="Stretch"
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}" AutomationProperties.AccessibilityView="Raw"/>
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> </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"
<AutoSuggestBox.QueryIcon> Translation="0,0,16"
<SymbolIcon Symbol="Find"/> VerticalAlignment="Top">
</AutoSuggestBox.QueryIcon> <AutoSuggestBox
<AutoSuggestBox.ItemTemplate> x:Name="SearchBox"
<DataTemplate > x:FieldModifier="public"
<Grid Height="72" Width="690" Background="Transparent" RowSpacing="0"> 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> <Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="PointerEntered"> <ToolkitBehaviors:Fade x:Name="ShowActionButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="1" />
<Core:CallMethodAction TargetObject="{Binding ElementName=ShowActionButtons}" MethodName="StartAnimation"/> <ToolkitBehaviors:Fade x:Name="HideActionsButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="0" />
</Core:EventTriggerBehavior>
<Core:EventTriggerBehavior EventName="PointerExited">
<Core:CallMethodAction TargetObject="{Binding ElementName=HideActionsButtons}" MethodName="StartAnimation"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors> </Interactivity:Interaction.Behaviors>
<Grid.ColumnDefinitions> <Button Background="Transparent" Height="42" Width="42" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
<ColumnDefinition Width="64" /> <ToolTipService.ToolTip>
<ColumnDefinition Width="*" /> <TextBlock Text="Run as administrator"/>
</Grid.ColumnDefinitions> </ToolTipService.ToolTip>
<Grid.RowDefinitions > <Button.Content>
<RowDefinition Height="*"/> <FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE7EF;"/>
<RowDefinition Height="*"/> </Button.Content>
</Grid.RowDefinitions> </Button>
<Button Background="Transparent" Height="42" Width="42" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
<Image x:Name="AppIcon" Height="36" Margin="8,0,0,0" Grid.RowSpan="2" HorizontalAlignment="Left" Source="{Binding Result.IcoPath}" /> <ToolTipService.ToolTip>
<TextBlock x:Name="Title" Grid.Column="1" Text="{Binding Result.Title}" FontWeight="SemiBold" FontSize="20" VerticalAlignment="Bottom"/> <TextBlock Text="Open file location"/>
<TextBlock x:Name="Path" Grid.Column="1" Text= "{Binding Result.SubTitle}" Grid.Row="1" Opacity="0.6" VerticalAlignment="Top"/> </ToolTipService.ToolTip>
<StackPanel Orientation="Horizontal" Opacity="0" HorizontalAlignment="Right" Grid.RowSpan="2" Grid.Column="1"> <Button.Content>
<Interactivity:Interaction.Behaviors> <FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE838;"/>
<ToolkitBehaviors:Fade x:Name="ShowActionButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="1" /> </Button.Content>
<ToolkitBehaviors:Fade x:Name="HideActionsButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="0" /> </Button>
</Interactivity:Interaction.Behaviors> <Button Background="Transparent" Height="42" Width="42" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}">
<Button Background="Transparent" Height="42" Width="42" Grid.Column="1" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}"> <ToolTipService.ToolTip>
<ToolTipService.ToolTip> <TextBlock Text="Open in console"/>
<TextBlock Text="Run as administrator"/> </ToolTipService.ToolTip>
</ToolTipService.ToolTip> <Button.Content>
<Button.Content> <FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE756;"/>
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="16" Glyph="&#xE7EF;"/> </Button.Content>
</Button.Content> </Button>
</Button> </StackPanel>
<Button Background="Transparent" Height="42" Width="42" Grid.Column="1" BorderThickness="1" Style="{ThemeResource ButtonRevealStyle}"> </Grid>
<ToolTipService.ToolTip> </DataTemplate>
<TextBlock Text="Open file location"/> </AutoSuggestBox.ItemTemplate>
</ToolTipService.ToolTip> </AutoSuggestBox>
<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>
</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}">
<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> <Window.InputBindings>
<KeyBinding Key="Escape" Command="{Binding EscCommand}"></KeyBinding> <KeyBinding Key="Escape" Command="{Binding EscCommand}" />
</Window.InputBindings> </Window.InputBindings>
</Window> </Window>