Przeglądaj źródła

Merge branch 'master' into fixes/6359-clip-transform

Wiesław Šoltés 4 lat temu
rodzic
commit
3b2f9eed3c

+ 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"

+ 12 - 6
src/Avalonia.Controls.DataGrid/DataGrid.cs

@@ -2223,6 +2223,7 @@ namespace Avalonia.Controls
             if (IsEnabled && DisplayData.NumDisplayedScrollingElements > 0)
             {
                 var handled = false;
+                var ignoreInvalidate = false;
                 var scrollHeight = 0d;
 
                 // Vertical scroll handling
@@ -2252,8 +2253,7 @@ namespace Avalonia.Controls
                 // Horizontal scroll handling
                 if (delta.X != 0)
                 {
-                    var originalHorizontalOffset = HorizontalOffset;
-                    var horizontalOffset = originalHorizontalOffset - delta.X;
+                    var horizontalOffset = HorizontalOffset - delta.X;
                     var widthNotVisible = Math.Max(0, ColumnsInternal.VisibleEdgedColumnsWidth - CellsWidth);
 
                     if (horizontalOffset < 0)
@@ -2265,16 +2265,20 @@ namespace Avalonia.Controls
                         horizontalOffset = widthNotVisible;
                     }
 
-                    if (horizontalOffset != originalHorizontalOffset)
+                    if (UpdateHorizontalOffset(horizontalOffset))
                     {
-                        HorizontalOffset = horizontalOffset;
+                        // We don't need to invalidate once again after UpdateHorizontalOffset.
+                        ignoreInvalidate = true;
                         handled = true;
                     }
                 }
 
                 if (handled)
                 {
-                    InvalidateRowsMeasure(invalidateIndividualElements: false);
+                    if (!ignoreInvalidate)
+                    {
+                        InvalidateRowsMeasure(invalidateIndividualElements: false);
+                    }
                     return true;
                 }
             }
@@ -2932,7 +2936,7 @@ namespace Avalonia.Controls
             return SetCurrentCellCore(columnIndex, slot, commitEdit: true, endRowEdit: true);
         }
 
-        internal void UpdateHorizontalOffset(double newValue)
+        internal bool UpdateHorizontalOffset(double newValue)
         {
             if (HorizontalOffset != newValue)
             {
@@ -2940,7 +2944,9 @@ namespace Avalonia.Controls
 
                 InvalidateColumnHeadersMeasure();
                 InvalidateRowsMeasure(true);
+                return true;
             }
+            return false;
         }
 
         internal bool UpdateSelectionAndCurrency(int columnIndex, int slot, DataGridSelectionAction action, bool scrollIntoView)

+ 7 - 0
src/Avalonia.Controls/Button.cs

@@ -358,6 +358,13 @@ namespace Avalonia.Controls
             IsPressed = false;
         }
 
+        protected override void OnLostFocus(RoutedEventArgs e)
+        {
+            base.OnLostFocus(e);
+
+            IsPressed = false;
+        }
+
         protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
         {
             base.OnPropertyChanged(change);

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

@@ -1,5 +1,11 @@
-<Style xmlns="https://github.com/avaloniaui" Selector="OverlayPopupHost">
-  <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
+<Style xmlns="https://github.com/avaloniaui" 
+       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+       Selector="OverlayPopupHost">
+  <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 - 2
src/Avalonia.Themes.Default/PopupRoot.xaml

@@ -1,5 +1,11 @@
-<Style xmlns="https://github.com/avaloniaui" Selector="PopupRoot">
-  <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
+<Style xmlns="https://github.com/avaloniaui"
+       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+       Selector="PopupRoot">
+  <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 - 1
src/Avalonia.Themes.Fluent/Controls/OverlayPopupHost.xaml

@@ -1,5 +1,9 @@
 <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 - 1
src/Avalonia.Themes.Fluent/Controls/PopupRoot.xaml

@@ -2,7 +2,11 @@
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
   <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>

+ 2 - 0
src/Avalonia.X11/X11IconLoader.cs

@@ -77,7 +77,9 @@ namespace Avalonia.X11
         public void Save(Stream outputStream)
         {
             using (var wr =
+#pragma warning disable CS0618 // Type or member is obsolete
                 new WriteableBitmap(new PixelSize(_width, _height), new Vector(96, 96), PixelFormat.Bgra8888))
+#pragma warning restore CS0618 // Type or member is obsolete
             {
                 using (var fb = wr.Lock())
                 {