Browse Source

transparent popups

pull/4033/head
Dan Walmsley 6 years ago
parent
commit
85f37abe21
  1. 15
      src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml
  2. 38
      src/Avalonia.Themes.Fluent/PopupRoot.xaml

15
src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml

@ -1,4 +1,5 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith> <Design.PreviewWith>
<Border Padding="20"> <Border Padding="20">
<AutoCompleteBox Width="200"> <AutoCompleteBox Width="200">
@ -43,17 +44,11 @@
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" /> DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" />
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
WindowManagerAddShadowHint="False"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}" MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}" MaxHeight="{TemplateBinding MaxDropDownHeight}"
StaysOpen="False" StaysOpen="False"
PlacementTarget="{TemplateBinding}"> PlacementTarget="{TemplateBinding}">
<Popup.Styles>
<Style Selector="PopupRoot">
<Setter Property="WindowManagerAddShadowHint" Value="False" />
<Setter Property="TransparencyLevelHint" Value="Transparent" />
<Setter Property="Background" Value="{x:Null}" />
</Style>
</Popup.Styles>
<Border Name="PART_SuggestionsContainer" <Border Name="PART_SuggestionsContainer"
Padding="{DynamicResource AutoCompleteListMargin}" Padding="{DynamicResource AutoCompleteListMargin}"
BorderThickness="{DynamicResource AutoCompleteListBorderThemeThickness}" BorderThickness="{DynamicResource AutoCompleteListBorderThemeThickness}"

38
src/Avalonia.Themes.Fluent/PopupRoot.xaml

@ -1,17 +1,21 @@
<Style xmlns="https://github.com/avaloniaui" Selector="PopupRoot"> <Styles xmlns="https://github.com/avaloniaui"
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Template"> <Style Selector="PopupRoot">
<ControlTemplate> <Setter Property="TransparencyLevelHint" Value="Transparent" />
<Panel> <Setter Property="Background" Value="{x:Null}" />
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" /> <Setter Property="Template">
<VisualLayerManager IsPopup="True"> <ControlTemplate>
<ContentPresenter Name="PART_ContentPresenter" <Panel>
Background="{TemplateBinding Background}" <Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
ContentTemplate="{TemplateBinding ContentTemplate}" <VisualLayerManager IsPopup="True">
Content="{TemplateBinding Content}" <ContentPresenter Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"/> Background="{TemplateBinding Background}"
</VisualLayerManager> ContentTemplate="{TemplateBinding ContentTemplate}"
</Panel> Content="{TemplateBinding Content}"
</ControlTemplate> Padding="{TemplateBinding Padding}"/>
</Setter> </VisualLayerManager>
</Style> </Panel>
</ControlTemplate>
</Setter>
</Style>
</Styles>

Loading…
Cancel
Save