Browse Source

Do not inherit text properties in Popup

Max Katz 4 years ago
parent
commit
9f5f0aa84d

+ 9 - 1
samples/ControlCatalog/Pages/TextBoxPage.xaml

@@ -11,7 +11,15 @@
               HorizontalAlignment="Center"
               Spacing="16">
       <StackPanel Orientation="Vertical" Spacing="8">
-        <TextBox Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit." Width="200" />
+        <TextBox Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit." Width="200"
+                 FontFamily="Comic Sans MS"
+                 Foreground="Blue">
+          <TextBox.ContextFlyout>
+            <Flyout>
+              <TextBlock>Custom context flyout</TextBlock>
+            </Flyout>
+          </TextBox.ContextFlyout>        
+        </TextBox>
         <TextBox Width="200" Watermark="ReadOnly" IsReadOnly="True" Text="This is read only"/>
         <TextBox Width="200" Watermark="Numeric Watermark" x:Name="numericWatermark"/>
         <TextBox Width="200"

+ 8 - 1
src/Avalonia.Themes.Default/OverlayPopupHost.xaml

@@ -1,5 +1,12 @@
-<Style xmlns="https://github.com/avaloniaui" Selector="OverlayPopupHost">
+<Style xmlns="https://github.com/avaloniaui" 
+       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+       Selector="OverlayPopupHost">
   <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
+  <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
+  <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}"/>
+  <Setter Property="FontFamily" Value="{x:Static FontFamily.Default}" />
+  <Setter Property="FontWeight" Value="400" />
+  <Setter Property="FontStyle" Value="Normal" />
   <Setter Property="Template">
     <ControlTemplate>
       <Panel>

+ 8 - 1
src/Avalonia.Themes.Default/PopupRoot.xaml

@@ -1,5 +1,12 @@
-<Style xmlns="https://github.com/avaloniaui" Selector="PopupRoot">
+<Style xmlns="https://github.com/avaloniaui"
+       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+       Selector="PopupRoot">
   <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
+  <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/>
+  <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}"/>
+  <Setter Property="FontFamily" Value="{x:Static FontFamily.Default}" />
+  <Setter Property="FontWeight" Value="400" />
+  <Setter Property="FontStyle" Value="Normal" />
   <Setter Property="Template">
     <ControlTemplate>
       <Panel>

+ 5 - 0
src/Avalonia.Themes.Fluent/Controls/OverlayPopupHost.xaml

@@ -1,5 +1,10 @@
 <Style xmlns="https://github.com/avaloniaui" Selector="OverlayPopupHost">
   <Setter Property="Background" Value="{DynamicResource SystemControlBackgroundAltHighBrush}"/>
+  <Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
+  <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}"/>
+  <Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
+  <Setter Property="FontWeight" Value="400" />
+  <Setter Property="FontStyle" Value="Normal" />
   <Setter Property="Template">
     <ControlTemplate>
       <Panel>

+ 5 - 0
src/Avalonia.Themes.Fluent/Controls/PopupRoot.xaml

@@ -3,6 +3,11 @@
   <Style Selector="PopupRoot">
     <Setter Property="TransparencyLevelHint" Value="Transparent" />
     <Setter Property="Background" Value="{x:Null}" />
+    <Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
+    <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}"/>
+    <Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
+    <Setter Property="FontWeight" Value="400" />
+    <Setter Property="FontStyle" Value="Normal" />
     <Setter Property="Template">
       <ControlTemplate>
         <Panel>