Browse Source

Merge pull request #8732 from AvaloniaUI/remove-obsolete-members-from-avalonia.controls-namespace

Remove obsolete members from Avalonia.Controls assembly.
Tako 3 years ago
parent
commit
1f2aef4873
27 changed files with 213 additions and 448 deletions
  1. 1 1
      samples/ControlCatalog/DecoratedWindow.xaml
  2. 3 3
      samples/ControlCatalog/MainWindow.xaml
  3. 2 2
      samples/ControlCatalog/Pages/NumericUpDownPage.xaml
  4. 4 4
      samples/ControlCatalog/ViewModels/ContextPageViewModel.cs
  5. 3 4
      samples/ControlCatalog/ViewModels/MenuPageViewModel.cs
  6. 136 129
      samples/RenderDemo/Pages/DrawingPage.xaml
  7. 14 9
      src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml
  8. 14 9
      src/Avalonia.Controls.ColorPicker/Themes/Simple/Simple.xaml
  9. 0 2
      src/Avalonia.Controls/DesktopApplicationExtensions.cs
  10. 0 61
      src/Avalonia.Controls/DrawingPresenter.cs
  11. 1 12
      src/Avalonia.Controls/LoggingExtensions.cs
  12. 0 7
      src/Avalonia.Controls/NativeMenuItem.cs
  13. 2 11
      src/Avalonia.Controls/NativeMenuItemSeparator.cs
  14. 0 53
      src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs
  15. 0 37
      src/Avalonia.Controls/Primitives/Popup.cs
  16. 0 12
      src/Avalonia.Controls/Primitives/TemplatedControl.cs
  17. 0 2
      src/Avalonia.Controls/ProgressBar.cs
  18. 0 2
      src/Avalonia.Controls/RichTextBlock.cs
  19. 3 17
      src/Avalonia.Controls/SystemDialog.cs
  20. 0 2
      src/Avalonia.Controls/TextBox.cs
  21. 0 3
      src/Avalonia.Controls/TopLevel.cs
  22. 1 43
      src/Avalonia.Controls/Window.cs
  23. 0 9
      src/Avalonia.Controls/WindowBase.cs
  24. 13 10
      src/Avalonia.Diagnostics/Diagnostics/Screenshots/FilePickerHandler.cs
  25. 5 1
      src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml
  26. 10 2
      src/Avalonia.Themes.Fluent/Controls/ManagedFileChooser.xaml
  27. 1 1
      src/Avalonia.Themes.Simple/Controls/CalendarDatePicker.xaml

+ 1 - 1
samples/ControlCatalog/DecoratedWindow.xaml

@@ -2,7 +2,7 @@
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         x:Class="ControlCatalog.DecoratedWindow"
         Title="Avalonia Control Gallery"
-        xmlns:local="clr-namespace:ControlCatalog" HasSystemDecorations="False" Name="Window">
+        xmlns:local="clr-namespace:ControlCatalog" SystemDecorations="None" Name="Window">
         <NativeMenu.Menu>
     <NativeMenu>
       <NativeMenuItem Header="Decorated">

+ 3 - 3
samples/ControlCatalog/MainWindow.xaml

@@ -18,15 +18,15 @@
     <NativeMenu>
       <NativeMenuItem Header="File">
         <NativeMenu>
-          <NativeMenuItem Icon="/Assets/test_icon.ico" Header="Open" Clicked="OnOpenClicked" Gesture="Ctrl+O"/>
-          <NativeMenuItemSeperator/><!-- Uses incorrect spelling to demonstrate backwards compatibility -->
+          <NativeMenuItem Icon="/Assets/test_icon.ico" Header="Open" Click="OnOpenClicked" Gesture="Ctrl+O"/>
+          <NativeMenuItemSeparator/>
           <NativeMenuItem Icon="/Assets/github_icon.png" Header="Recent">
             <NativeMenu/>
           </NativeMenuItem>
           <NativeMenuItemSeparator/>
           <NativeMenuItem Header="{x:Static local:MainWindow.MenuQuitHeader}"
                           Gesture="{x:Static local:MainWindow.MenuQuitGesture}"
-                          Clicked="OnCloseClicked" />
+                          Click="OnCloseClicked" />
         </NativeMenu>
       </NativeMenuItem>
       <NativeMenuItem Header="Edit">

+ 2 - 2
samples/ControlCatalog/Pages/NumericUpDownPage.xaml

@@ -54,11 +54,11 @@
       <Grid Grid.Row="0" Grid.Column="2" Margin="8" RowDefinitions="Auto,Auto,Auto,Auto,Auto" ColumnDefinitions="Auto, Auto">
         <TextBlock Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="10,2,2,2">Minimum:</TextBlock>
         <NumericUpDown Grid.Row="0" Grid.Column="1" Value="{Binding #upDown.Minimum}"
-                       CultureInfo="{Binding #upDown.CultureInfo}" VerticalAlignment="Center" Margin="2" HorizontalAlignment="Center"/>
+                       NumberFormat="{Binding #upDown.NumberFormat}" VerticalAlignment="Center" Margin="2" HorizontalAlignment="Center"/>
 
         <TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Margin="10,2,2,2">Maximum:</TextBlock>
         <NumericUpDown Grid.Row="1" Grid.Column="1" Value="{Binding #upDown.Maximum}"
-                       CultureInfo="{Binding #upDown.CultureInfo}" VerticalAlignment="Center" Margin="2" HorizontalAlignment="Center"/>
+                       NumberFormat="{Binding #upDown.NumberFormat}" VerticalAlignment="Center" Margin="2" HorizontalAlignment="Center"/>
 
         <TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="10,2,2,2">Increment:</TextBlock>
         <NumericUpDown Grid.Row="2" Grid.Column="1" Value="{Binding #upDown.Increment}" VerticalAlignment="Center"

+ 4 - 4
samples/ControlCatalog/ViewModels/ContextPageViewModel.cs

@@ -53,14 +53,14 @@ namespace ControlCatalog.ViewModels
             var window = View?.GetVisualRoot() as Window;
             if (window == null)
                 return;
-            var dialog = new OpenFileDialog();
-            var result = await dialog.ShowAsync(window);
+
+            var result = await window.StorageProvider.OpenFilePickerAsync(new Avalonia.Platform.Storage.FilePickerOpenOptions() { AllowMultiple = true });
 
             if (result != null)
             {
-                foreach (var path in result)
+                foreach (var file in result)
                 {
-                    System.Diagnostics.Debug.WriteLine($"Opened: {path}");
+                    System.Diagnostics.Debug.WriteLine($"Opened: {file.Name}");
                 }
             }
         }

+ 3 - 4
samples/ControlCatalog/ViewModels/MenuPageViewModel.cs

@@ -74,14 +74,13 @@ namespace ControlCatalog.ViewModels
             var window = View?.GetVisualRoot() as Window;
             if (window == null)
                 return;
-            var dialog = new OpenFileDialog();
-            var result = await dialog.ShowAsync(window);
+            var result = await window.StorageProvider.OpenFilePickerAsync(new Avalonia.Platform.Storage.FilePickerOpenOptions() { AllowMultiple = true });
 
             if (result != null)
             {
-                foreach (var path in result)
+                foreach (var file in result)
                 {
-                    System.Diagnostics.Debug.WriteLine($"Opened: {path}");
+                    System.Diagnostics.Debug.WriteLine($"Opened: {file.Name}");
                 }
             }
         }

+ 136 - 129
samples/RenderDemo/Pages/DrawingPage.xaml

@@ -1,134 +1,141 @@
-<UserControl 
-    xmlns="https://github.com/avaloniaui" 
+<UserControl
+    xmlns="https://github.com/avaloniaui"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     x:Class="RenderDemo.Pages.DrawingPage">
-    <UserControl.Styles>
-        <Style>
-            <Style.Resources>
-                <DrawingGroup x:Key="Bulb">
-                    <DrawingGroup.Transform>
-                        <MatrixTransform Matrix="1,0,0,1,0,-1028.4" />
-                    </DrawingGroup.Transform>
-                    <DrawingGroup>
-                        <DrawingGroup.Transform>
-                            <MatrixTransform Matrix="1,0,0,1.25,-10,1031.4" />
-                        </DrawingGroup.Transform>
-                        <GeometryDrawing Brush="#FF7F8C8D"
-                                         Geometry="F1 M24,14 A2,2,0,1,1,20,14 A2,2,0,1,1,24,14 z" />
-                    </DrawingGroup>
-                    <GeometryDrawing Brush="#FFF39C12"
-                                     Geometry="F1 M12,1030.4 C8.134,1030.4 5,1033.6 5,1037.6 5,1040.7 8.125,1043.5 9,1045.4 9.875,1047.2 9,1050.4 9,1050.4 L12,1049.9 15,1050.4 C15,1050.4 14.125,1047.2 15,1045.4 15.875,1043.5 19,1040.7 19,1037.6 19,1033.6 15.866,1030.4 12,1030.4 z" />
-                    <GeometryDrawing Brush="#FFF1C40F"
-                                     Geometry="F1 M12,1030.4 C15.866,1030.4 19,1033.6 19,1037.6 19,1040.7 15.875,1043.5 15,1045.4 14.125,1047.2 15,1050.4 15,1050.4 L12,1049.9 12,1030.4 z" />
-                    <GeometryDrawing Brush="#FFE67E22"
-                                     Geometry="F1 M9,1036.4 L8,1037.4 12,1049.4 16,1037.4 15,1036.4 14,1037.4 13,1036.4 12,1037.4 11,1036.4 10,1037.4 9,1036.4 z M9,1037.4 L10,1038.4 10.5,1037.9 11,1037.4 11.5,1037.9 12,1038.4 12.5,1037.9 13,1037.4 13.5,1037.9 14,1038.4 15,1037.4 15.438,1037.8 12,1048.1 8.5625,1037.8 9,1037.4 z" />
-                    <DrawingGroup>
-                        <DrawingGroup.Transform>
-                            <MatrixTransform Matrix="1,0,0,1,9,1045.4" />
-                        </DrawingGroup.Transform>
-                        <GeometryDrawing Brush="#FFBDC3C7">
-                            <GeometryDrawing.Geometry>
-                                <RectangleGeometry Rect="0,0,6,5" />
-                            </GeometryDrawing.Geometry>
-                        </GeometryDrawing>
-                    </DrawingGroup>
-                    <GeometryDrawing Brush="#FF95A5A6"
-                                     Geometry="F1 M9,1045.4 L9,1050.4 12,1050.4 12,1049.4 15,1049.4 15,1048.4 12,1048.4 12,1047.4 15,1047.4 15,1046.4 12,1046.4 12,1045.4 9,1045.4 z" />
-                    <GeometryDrawing Brush="#FF7F8C8D"
-                                     Geometry="F1 M9,1046.4 L9,1047.4 12,1047.4 12,1046.4 9,1046.4 z M9,1048.4 L9,1049.4 12,1049.4 12,1048.4 9,1048.4 z" />
-                </DrawingGroup>
-            </Style.Resources>
-        </Style>
-    </UserControl.Styles>
-    <Grid RowDefinitions="Auto,Auto,Auto"
-          ColumnDefinitions="Auto,Auto,Auto,Auto">
-        <TextBlock Text="None"
-                   Margin="3" />
-        <Border Grid.Column="0"
-                Grid.Row="1"
-                VerticalAlignment="Top"
-                HorizontalAlignment="Left"
-                BorderThickness="1"
-                BorderBrush="Gray"
-                Margin="5">
-            <DrawingPresenter Drawing="{DynamicResource Bulb}" />
-        </Border>
-        <TextBlock Text="Fill"
-                   Margin="3"
-                   Grid.Column="1" />
-        <Border Grid.Column="1"
-                Grid.Row="1"
-                VerticalAlignment="Top"
-                HorizontalAlignment="Left"
-                BorderThickness="1"
-                BorderBrush="Gray"
-                Margin="5">
-            <DrawingPresenter Drawing="{DynamicResource Bulb}"
-                              Width="100"
-                              Height="50"
-                              Stretch="Fill" />
-        </Border>
-        <TextBlock Text="Uniform"
-                   Margin="3"
-                   Grid.Column="2" />
-        <Border Grid.Column="2"
-                Grid.Row="1"
-                VerticalAlignment="Top"
-                HorizontalAlignment="Left"
-                BorderThickness="1"
-                BorderBrush="Gray"
-                Margin="5">
-            <DrawingPresenter Drawing="{DynamicResource Bulb}"
-                              Width="100"
-                              Height="50"
-                              Stretch="Uniform" />
-        </Border>
-        <TextBlock Text="UniformToFill"
-                   Margin="3"
-                   Grid.Column="3" />
-        <Border Grid.Column="3"
-                Grid.Row="1"
-                VerticalAlignment="Top"
-                HorizontalAlignment="Left"
-                BorderThickness="1"
-                BorderBrush="Gray"
-                Margin="5">
-            <DrawingPresenter Drawing="{DynamicResource Bulb}"
-                              Width="100"
-                              Height="50"
-                              Stretch="UniformToFill" />
-        </Border>
+  <UserControl.Styles>
+    <Style>
+      <Style.Resources>
+        <DrawingGroup x:Key="Bulb">
+          <DrawingGroup.Transform>
+            <MatrixTransform Matrix="1,0,0,1,0,-1028.4" />
+          </DrawingGroup.Transform>
+          <DrawingGroup>
+            <DrawingGroup.Transform>
+              <MatrixTransform Matrix="1,0,0,1.25,-10,1031.4" />
+            </DrawingGroup.Transform>
+            <GeometryDrawing Brush="#FF7F8C8D"
+                             Geometry="F1 M24,14 A2,2,0,1,1,20,14 A2,2,0,1,1,24,14 z" />
+          </DrawingGroup>
+          <GeometryDrawing Brush="#FFF39C12"
+                           Geometry="F1 M12,1030.4 C8.134,1030.4 5,1033.6 5,1037.6 5,1040.7 8.125,1043.5 9,1045.4 9.875,1047.2 9,1050.4 9,1050.4 L12,1049.9 15,1050.4 C15,1050.4 14.125,1047.2 15,1045.4 15.875,1043.5 19,1040.7 19,1037.6 19,1033.6 15.866,1030.4 12,1030.4 z" />
+          <GeometryDrawing Brush="#FFF1C40F"
+                           Geometry="F1 M12,1030.4 C15.866,1030.4 19,1033.6 19,1037.6 19,1040.7 15.875,1043.5 15,1045.4 14.125,1047.2 15,1050.4 15,1050.4 L12,1049.9 12,1030.4 z" />
+          <GeometryDrawing Brush="#FFE67E22"
+                           Geometry="F1 M9,1036.4 L8,1037.4 12,1049.4 16,1037.4 15,1036.4 14,1037.4 13,1036.4 12,1037.4 11,1036.4 10,1037.4 9,1036.4 z M9,1037.4 L10,1038.4 10.5,1037.9 11,1037.4 11.5,1037.9 12,1038.4 12.5,1037.9 13,1037.4 13.5,1037.9 14,1038.4 15,1037.4 15.438,1037.8 12,1048.1 8.5625,1037.8 9,1037.4 z" />
+          <DrawingGroup>
+            <DrawingGroup.Transform>
+              <MatrixTransform Matrix="1,0,0,1,9,1045.4" />
+            </DrawingGroup.Transform>
+            <GeometryDrawing Brush="#FFBDC3C7">
+              <GeometryDrawing.Geometry>
+                <RectangleGeometry Rect="0,0,6,5" />
+              </GeometryDrawing.Geometry>
+            </GeometryDrawing>
+          </DrawingGroup>
+          <GeometryDrawing Brush="#FF95A5A6"
+                           Geometry="F1 M9,1045.4 L9,1050.4 12,1050.4 12,1049.4 15,1049.4 15,1048.4 12,1048.4 12,1047.4 15,1047.4 15,1046.4 12,1046.4 12,1045.4 9,1045.4 z" />
+          <GeometryDrawing Brush="#FF7F8C8D"
+                           Geometry="F1 M9,1046.4 L9,1047.4 12,1047.4 12,1046.4 9,1046.4 z M9,1048.4 L9,1049.4 12,1049.4 12,1048.4 9,1048.4 z" />
+        </DrawingGroup>
+      </Style.Resources>
+    </Style>
+  </UserControl.Styles>
+  <Grid RowDefinitions="Auto,Auto,Auto"
+        ColumnDefinitions="Auto,Auto,Auto,Auto">
+    <TextBlock Text="None"
+               Margin="3" />
+    <Border Grid.Column="0"
+            Grid.Row="1"
+            VerticalAlignment="Top"
+            HorizontalAlignment="Left"
+            BorderThickness="1"
+            BorderBrush="Gray"
+            Margin="5">
+      <Image>
+        <Image.Source>
+          <DrawingImage Drawing="{DynamicResource Bulb}" />
+        </Image.Source>
+      </Image>
+    </Border>
+    <TextBlock Text="Fill"
+               Margin="3"
+               Grid.Column="1" />
+    <Border Grid.Column="1"
+            Grid.Row="1"
+            VerticalAlignment="Top"
+            HorizontalAlignment="Left"
+            BorderThickness="1"
+            BorderBrush="Gray"
+            Margin="5">
+      <Image Width="100" Height="50" Stretch="Fill">
+        <Image.Source>
+          <DrawingImage Drawing="{DynamicResource Bulb}" />
+        </Image.Source>
+      </Image>
+    </Border>
+    <TextBlock Text="Uniform"
+               Margin="3"
+               Grid.Column="2" />
+    <Border Grid.Column="2"
+            Grid.Row="1"
+            VerticalAlignment="Top"
+            HorizontalAlignment="Left"
+            BorderThickness="1"
+            BorderBrush="Gray"
+            Margin="5">
+      <Image Width="100" Height="50" Stretch="Uniform">
+        <Image.Source>
+          <DrawingImage Drawing="{DynamicResource Bulb}" />
+        </Image.Source>
+      </Image>
+    </Border>
+    <TextBlock Text="UniformToFill"
+               Margin="3"
+               Grid.Column="3" />
+    <Border Grid.Column="3"
+            Grid.Row="1"
+            VerticalAlignment="Top"
+            HorizontalAlignment="Left"
+            BorderThickness="1"
+            BorderBrush="Gray"
+            Margin="5">
+      <Image Width="100" Height="50" Stretch="UniformToFill">
+        <Image.Source>
+          <DrawingImage Drawing="{DynamicResource Bulb}" />
+        </Image.Source>
+      </Image>
+    </Border>
 
-        <!-- For comparison -->
+    <!-- For comparison -->
 
-        <Ellipse Grid.Row="2"
-                 Grid.Column="0"
-                 Width="100"
-                 Height="50"
-                 Stretch="None"
-                 Fill="Blue"
-                 Margin="5"/>
-        <Ellipse Grid.Row="2"
-                 Grid.Column="1"
-                 Width="100"
-                 Height="50"
-                 Stretch="Fill"
-                 Fill="Blue"
-                 Margin="5" />
-        <Ellipse Grid.Row="2"
-                 Grid.Column="2"
-                 Width="100"
-                 Height="50"
-                 Stretch="Uniform"
-                 Fill="Blue"
-                 Margin="5" />
-        <Ellipse Grid.Row="2"
-                 Grid.Column="3"
-                 Width="100"
-                 Height="50"
-                 Stretch="UniformToFill"
-                 Fill="Blue"
-                 Margin="5" />
+    <Ellipse Grid.Row="2"
+             Grid.Column="0"
+             Width="100"
+             Height="50"
+             Stretch="None"
+             Fill="Blue"
+             Margin="5"/>
+    <Ellipse Grid.Row="2"
+             Grid.Column="1"
+             Width="100"
+             Height="50"
+             Stretch="Fill"
+             Fill="Blue"
+             Margin="5" />
+    <Ellipse Grid.Row="2"
+             Grid.Column="2"
+             Width="100"
+             Height="50"
+             Stretch="Uniform"
+             Fill="Blue"
+             Margin="5" />
+    <Ellipse Grid.Row="2"
+             Grid.Column="3"
+             Width="100"
+             Height="50"
+             Stretch="UniformToFill"
+             Fill="Blue"
+             Margin="5" />
 
-    </Grid>
-</UserControl>
+  </Grid>
+</UserControl>

+ 14 - 9
src/Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml

@@ -11,15 +11,20 @@
                    Stretch="Uniform"
                    DestinationRect="0,0,8,8">
         <VisualBrush.Visual>
-          <DrawingPresenter Width="8"
-                            Height="8">
-            <DrawingGroup>
-              <GeometryDrawing Geometry="M0,0 L2,0 2,2, 0,2Z"
-                               Brush="Transparent" />
-              <GeometryDrawing Geometry="M0,1 L2,1 2,2, 1,2 1,0 0,0Z"
-                               Brush="#19808080" />
-            </DrawingGroup>
-          </DrawingPresenter>
+          <Image Width="8" Height="8">
+            <Image.Source>
+              <DrawingImage>
+                <DrawingImage.Drawing>
+                    <DrawingGroup>
+                      <GeometryDrawing Geometry="M0,0 L2,0 2,2, 0,2Z"
+                                       Brush="Transparent" />
+                      <GeometryDrawing Geometry="M0,1 L2,1 2,2, 1,2 1,0 0,0Z"
+                                       Brush="#19808080" />
+                    </DrawingGroup>
+                </DrawingImage.Drawing>
+              </DrawingImage>
+            </Image.Source>
+          </Image>
         </VisualBrush.Visual>
       </VisualBrush>
 

+ 14 - 9
src/Avalonia.Controls.ColorPicker/Themes/Simple/Simple.xaml

@@ -11,15 +11,20 @@
                    Stretch="Uniform"
                    DestinationRect="0,0,8,8">
         <VisualBrush.Visual>
-          <DrawingPresenter Width="8"
-                            Height="8">
-            <DrawingGroup>
-              <GeometryDrawing Geometry="M0,0 L2,0 2,2, 0,2Z"
-                               Brush="Transparent" />
-              <GeometryDrawing Geometry="M0,1 L2,1 2,2, 1,2 1,0 0,0Z"
-                               Brush="#19808080" />
-            </DrawingGroup>
-          </DrawingPresenter>
+          <Image Width="8" Height="8">
+            <Image.Source>
+              <DrawingImage>
+                <DrawingImage.Drawing>
+                  <DrawingGroup>
+                    <GeometryDrawing Geometry="M0,0 L2,0 2,2, 0,2Z"
+                                     Brush="Transparent" />
+                    <GeometryDrawing Geometry="M0,1 L2,1 2,2, 1,2 1,0 0,0Z"
+                                     Brush="#19808080" />
+                  </DrawingGroup>
+                </DrawingImage.Drawing>
+              </DrawingImage>
+            </Image.Source>
+          </Image>
         </VisualBrush.Visual>
       </VisualBrush>
 

+ 0 - 2
src/Avalonia.Controls/DesktopApplicationExtensions.cs

@@ -8,8 +8,6 @@ namespace Avalonia.Controls
 {
     public static class DesktopApplicationExtensions
     {
-        [Obsolete("Running application without a cancellation token and a lifetime is no longer supported, see https://github.com/AvaloniaUI/Avalonia/wiki/Application-lifetimes for details", true)]
-        public static void Run(this Application app) => throw new NotSupportedException();
 
         /// <summary>
         /// On desktop-style platforms runs the application's main loop until closable is closed

+ 0 - 61
src/Avalonia.Controls/DrawingPresenter.cs

@@ -1,61 +0,0 @@
-using System;
-using Avalonia.Controls.Shapes;
-using Avalonia.Media;
-using Avalonia.Metadata;
-
-namespace Avalonia.Controls
-{
-    [Obsolete("Use Image control with DrawingImage source")]
-    public class DrawingPresenter : Control
-    {
-        static DrawingPresenter()
-        {
-            AffectsMeasure<DrawingPresenter>(DrawingProperty);
-            AffectsRender<DrawingPresenter>(DrawingProperty);
-        }
-
-        public static readonly StyledProperty<Drawing> DrawingProperty =
-            AvaloniaProperty.Register<DrawingPresenter, Drawing>(nameof(Drawing));
-
-        public static readonly StyledProperty<Stretch> StretchProperty =
-            AvaloniaProperty.Register<DrawingPresenter, Stretch>(nameof(Stretch), Stretch.Uniform);
-
-        [Content]
-        public Drawing Drawing
-        {
-            get => GetValue(DrawingProperty);
-            set => SetValue(DrawingProperty, value);
-        }
-
-        public Stretch Stretch
-        {
-            get => GetValue(StretchProperty);
-            set => SetValue(StretchProperty, value);
-        }
-
-        private Matrix _transform = Matrix.Identity;
-
-        protected override Size MeasureOverride(Size availableSize)
-        {
-            if (Drawing == null) return new Size();
-
-            var (size, transform) = Shape.CalculateSizeAndTransform(availableSize, Drawing.GetBounds(), Stretch);
-
-            _transform = transform;
-
-            return size;
-        }
-
-        public override void Render(DrawingContext context)
-        {
-            if (Drawing != null)
-            {
-                using (context.PushPreTransform(_transform))
-                using (context.PushClip(new Rect(Bounds.Size)))
-                {
-                    Drawing.Draw(context);
-                }
-            }
-        }
-    }
-}

+ 1 - 12
src/Avalonia.Controls/LoggingExtensions.cs

@@ -1,21 +1,10 @@
-using System;
-using Avalonia.Controls;
+using Avalonia.Controls;
 using Avalonia.Logging;
 
 namespace Avalonia
 {
     public static class LoggingExtensions
     {
-        [Obsolete("Use LogToTrace")]
-        public static T LogToDebug<T>(
-            this T builder,
-            LogEventLevel level = LogEventLevel.Warning,
-            params string[] areas)
-                where T : AppBuilderBase<T>, new()
-        {
-            return LogToTrace(builder, level, areas);
-        }
-
         /// <summary>
         /// Logs Avalonia events to the <see cref="System.Diagnostics.Trace"/> sink.
         /// </summary>

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

@@ -186,13 +186,6 @@ namespace Avalonia.Controls
         /// </summary>
         public event EventHandler? Click;
 
-        [Obsolete("Use Click event.")]
-        public event EventHandler Clicked
-        {
-            add => Click += value;
-            remove => Click -= value;
-        }
-
         void INativeMenuItemExporterEventsImplBridge.RaiseClicked()
         {
             Click?.Invoke(this, new EventArgs());

+ 2 - 11
src/Avalonia.Controls/NativeMenuItemSeparator.cs

@@ -1,16 +1,7 @@
-using System;
-
-namespace Avalonia.Controls
+namespace Avalonia.Controls
 {
-
-    [Obsolete("This class exists to maintain backwards compatibility with existing code. Use NativeMenuItemSeparator instead")]
-    public class NativeMenuItemSeperator : NativeMenuItemSeparator 
-    {
-    }
-
     public class NativeMenuItemSeparator : NativeMenuItemBase
     {
-        [Obsolete("This is a temporary hack to make our MenuItem recognize this as a separator, don't use", true)]
-        public string Header => "-";
+
     }
 }

+ 0 - 53
src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs

@@ -45,14 +45,6 @@ namespace Avalonia.Controls
             AvaloniaProperty.RegisterDirect<NumericUpDown, bool>(nameof(ClipValueToMinMax),
                 updown => updown.ClipValueToMinMax, (updown, b) => updown.ClipValueToMinMax = b);
 
-        /// <summary>
-        /// Defines the <see cref="CultureInfo"/> property.
-        /// </summary>
-        [Obsolete]
-        public static readonly DirectProperty<NumericUpDown, CultureInfo?> CultureInfoProperty =
-            AvaloniaProperty.RegisterDirect<NumericUpDown, CultureInfo?>(nameof(CultureInfo), o => o.CultureInfo,
-                (o, v) => o.CultureInfo = v, CultureInfo.CurrentCulture);
-
         /// <summary>
         /// Defines the <see cref="NumberFormat"/> property.
         /// </summary>
@@ -187,21 +179,6 @@ namespace Avalonia.Controls
             set { SetAndRaise(ClipValueToMinMaxProperty, ref _clipValueToMinMax, value); }
         }
 
-        /// <summary>
-        /// Gets or sets the current CultureInfo.
-        /// </summary>
-        [Obsolete("CultureInfo is obsolete, please use NumberFormat instead.")]
-        public CultureInfo? CultureInfo
-        {
-            get { return _cultureInfo; }
-            set
-            {
-                SetAndRaise(CultureInfoProperty, ref _cultureInfo, value);
-                //Set and Raise the NumberFormatProperty when CultureInfo is changed.
-                SetAndRaise(NumberFormatProperty, ref _numberFormat, value?.NumberFormat);
-            }
-        }
-
         /// <summary>
         /// Gets or sets the current NumberFormatInfo
         /// </summary>
@@ -335,9 +312,6 @@ namespace Avalonia.Controls
         /// </summary>
         static NumericUpDown()
         {
-#pragma warning disable CS0612 // Type or member is obsolete
-            CultureInfoProperty.Changed.Subscribe(OnCultureInfoChanged);
-#pragma warning restore CS0612 // Type or member is obsolete
             NumberFormatProperty.Changed.Subscribe(OnNumberFormatChanged);
             FormatStringProperty.Changed.Subscribe(FormatStringChanged);
             IncrementProperty.Changed.Subscribe(IncrementChanged);
@@ -416,19 +390,6 @@ namespace Avalonia.Controls
             }
         }
 
-        /// <summary>
-        /// Called when the <see cref="CultureInfo"/> property value changed.
-        /// </summary>
-        /// <param name="oldValue">The old value.</param>
-        /// <param name="newValue">The new value.</param>
-        protected virtual void OnCultureInfoChanged(CultureInfo? oldValue, CultureInfo? newValue)
-        {
-            if (IsInitialized)
-            {
-                SyncTextAndValueProperties(false, null);
-            }
-        }
-
         /// <summary>
         /// Called when the <see cref="NumberFormat"/> property value changed.
         /// </summary>
@@ -729,20 +690,6 @@ namespace Avalonia.Controls
             }
         }
 
-        /// <summary>
-        /// Called when the <see cref="CultureInfo"/> property value changed.
-        /// </summary>
-        /// <param name="e">The event args.</param>
-        private static void OnCultureInfoChanged(AvaloniaPropertyChangedEventArgs e)
-        {
-            if (e.Sender is NumericUpDown upDown)
-            {
-                var oldValue = (CultureInfo?)e.OldValue;
-                var newValue = (CultureInfo?)e.NewValue;
-                upDown.OnCultureInfoChanged(oldValue, newValue);
-            }
-        }
-
         /// <summary>
         /// Called when the <see cref="NumberFormat"/> property value changed.
         /// </summary>

+ 0 - 37
src/Avalonia.Controls/Primitives/Popup.cs

@@ -88,14 +88,6 @@ namespace Avalonia.Controls.Primitives
         public static readonly StyledProperty<Control?> PlacementTargetProperty =
             AvaloniaProperty.Register<Popup, Control?>(nameof(PlacementTarget));
 
-#pragma warning disable 618
-        /// <summary>
-        /// Defines the <see cref="ObeyScreenEdges"/> property.
-        /// </summary>
-        public static readonly StyledProperty<bool> ObeyScreenEdgesProperty =
-            AvaloniaProperty.Register<Popup, bool>(nameof(ObeyScreenEdges), true);
-#pragma warning restore 618
-
         public static readonly StyledProperty<bool> OverlayDismissEventPassThroughProperty =
             AvaloniaProperty.Register<Popup, bool>(nameof(OverlayDismissEventPassThrough));
 
@@ -123,17 +115,6 @@ namespace Avalonia.Controls.Primitives
         public static readonly StyledProperty<double> VerticalOffsetProperty =
             AvaloniaProperty.Register<Popup, double>(nameof(VerticalOffset));
 
-        /// <summary>
-        /// Defines the <see cref="StaysOpen"/> property.
-        /// </summary>
-        [Obsolete("Use IsLightDismissEnabledProperty")]
-        public static readonly DirectProperty<Popup, bool> StaysOpenProperty =
-            AvaloniaProperty.RegisterDirect<Popup, bool>(
-                nameof(StaysOpen),
-                o => o.StaysOpen,
-                (o, v) => o.StaysOpen = v,
-                true);
-
         /// <summary>
         /// Defines the <see cref="Topmost"/> property.
         /// </summary>
@@ -299,13 +280,6 @@ namespace Avalonia.Controls.Primitives
             set { SetValue(PlacementTargetProperty, value); }
         }
 
-        [Obsolete("This property has no effect")]
-        public bool ObeyScreenEdges
-        {
-            get => GetValue(ObeyScreenEdgesProperty);
-            set => SetValue(ObeyScreenEdgesProperty, value);
-        }
-
         /// <summary>
         /// Gets or sets a value indicating whether the event that closes the popup is passed
         /// through to the parent window.
@@ -350,17 +324,6 @@ namespace Avalonia.Controls.Primitives
             set { SetValue(VerticalOffsetProperty, value); }
         }
 
-        /// <summary>
-        /// Gets or sets a value indicating whether the popup should stay open when the popup is
-        /// pressed or loses focus.
-        /// </summary>
-        [Obsolete("Use IsLightDismissEnabled")]
-        public bool StaysOpen
-        {
-            get => !IsLightDismissEnabled;
-            set => IsLightDismissEnabled = !value;
-        }
-
         /// <summary>
         /// Gets or sets whether this popup appears on top of all other windows
         /// </summary>

+ 0 - 12
src/Avalonia.Controls/Primitives/TemplatedControl.cs

@@ -297,9 +297,6 @@ namespace Avalonia.Controls.Primitives
 
                     var e = new TemplateAppliedEventArgs(nameScope);
                     OnApplyTemplate(e);
-#pragma warning disable CS0618 // Type or member is obsolete
-                    OnTemplateApplied(e);
-#pragma warning restore CS0618 // Type or member is obsolete
                     RaiseEvent(e);
                 }
 
@@ -378,15 +375,6 @@ namespace Avalonia.Controls.Primitives
             }
         }
 
-        /// <summary>
-        /// Called when the control's template is applied.
-        /// </summary>
-        /// <param name="e">The event args.</param>
-        [Obsolete("Use OnApplyTemplate")]
-        protected virtual void OnTemplateApplied(TemplateAppliedEventArgs e)
-        {
-        }
-
         /// <summary>
         /// Called when the <see cref="Template"/> property changes.
         /// </summary>

+ 0 - 2
src/Avalonia.Controls/ProgressBar.cs

@@ -251,11 +251,9 @@ namespace Avalonia.Controls
                     TemplateProperties.Container2AnimationEndPosition = barIndicatorWidth2 * 1.66; // Position at 166%
 
 
-#pragma warning disable CS0618 // Type or member is obsolete
                     // Remove these properties when we switch to fluent as default and removed the old one.
                     IndeterminateStartingOffset = -dim;
                     IndeterminateEndingOffset = dim;
-#pragma warning restore CS0618 // Type or member is obsolete
 
                     var padding = Padding;
                     var rectangle = new RectangleGeometry(

+ 0 - 2
src/Avalonia.Controls/RichTextBlock.cs

@@ -381,9 +381,7 @@ namespace Avalonia.Controls
                 var hit = TextLayout.HitTestPoint(point);
                 var index = hit.TextPosition;
 
-#pragma warning disable CS0618 // Type or member is obsolete
                 switch (e.ClickCount)
-#pragma warning restore CS0618 // Type or member is obsolete
                 {
                     case 1:
                         if (clickToSelect)

+ 3 - 17
src/Avalonia.Controls/SystemDialog.cs

@@ -32,13 +32,6 @@ namespace Avalonia.Controls
     [Obsolete("Use Window.StorageProvider API or TopLevel.StorageProvider API")]
     public abstract class FileSystemDialog : SystemDialog
     {
-        [Obsolete("Use Directory")]
-        public string? InitialDirectory
-        {
-            get => Directory;
-            set => Directory = value;
-        }
-
         /// <summary>
         /// Gets or sets the initial directory that will be displayed when the file system dialog
         /// is opened.
@@ -87,7 +80,7 @@ namespace Avalonia.Controls
                 DefaultExtension = DefaultExtension,
                 FileTypeChoices = Filters?.Select(f => new FilePickerFileType(f.Name!) { Patterns = f.Extensions.Select(e => $"*.{e}").ToArray() }).ToArray(),
                 Title = Title,
-                SuggestedStartLocation = InitialDirectory is { } directory
+                SuggestedStartLocation = Directory is { } directory
                         ? new BclStorageFolder(new System.IO.DirectoryInfo(directory))
                         : null,
                 ShowOverwritePrompt = ShowOverwritePrompt
@@ -129,7 +122,7 @@ namespace Avalonia.Controls
                 AllowMultiple = AllowMultiple,
                 FileTypeFilter = Filters?.Select(f => new FilePickerFileType(f.Name!) { Patterns = f.Extensions.Select(e => $"*.{e}").ToArray() }).ToArray(),
                 Title = Title,
-                SuggestedStartLocation = InitialDirectory is { } directory
+                SuggestedStartLocation = Directory is { } directory
                     ? new BclStorageFolder(new System.IO.DirectoryInfo(directory))
                     : null
             };
@@ -142,13 +135,6 @@ namespace Avalonia.Controls
     [Obsolete("Use Window.StorageProvider API or TopLevel.StorageProvider API")]
     public class OpenFolderDialog : FileSystemDialog
     {
-        [Obsolete("Use Directory")]
-        public string? DefaultDirectory
-        {
-            get => Directory;
-            set => Directory = value;
-        }
-
         /// <summary>
         /// Shows the open folder dialog.
         /// </summary>
@@ -170,7 +156,7 @@ namespace Avalonia.Controls
             return new FolderPickerOpenOptions
             {
                 Title = Title,
-                SuggestedStartLocation = InitialDirectory is { } directory
+                SuggestedStartLocation = Directory is { } directory
                     ? new BclStorageFolder(new System.IO.DirectoryInfo(directory))
                     : null
             };

+ 0 - 2
src/Avalonia.Controls/TextBox.cs

@@ -1165,9 +1165,7 @@ namespace Avalonia.Controls
 
                 SetAndRaise(CaretIndexProperty, ref _caretIndex, index);
 
-#pragma warning disable CS0618 // Type or member is obsolete
                 switch (e.ClickCount)
-#pragma warning restore CS0618 // Type or member is obsolete
                 {
                     case 1:
                         if (clickToSelect)

+ 0 - 3
src/Avalonia.Controls/TopLevel.cs

@@ -404,9 +404,6 @@ namespace Avalonia.Controls
             LayoutManager?.Dispose();
         }
 
-        [Obsolete("Use HandleResized(Size, PlatformResizeReason)")]
-        protected virtual void HandleResized(Size clientSize) => HandleResized(clientSize, PlatformResizeReason.Unspecified);
-
         /// <summary>
         /// Handles a resize notification from <see cref="ITopLevelImpl.Resized"/>.
         /// </summary>

+ 1 - 43
src/Avalonia.Controls/Window.cs

@@ -79,16 +79,6 @@ namespace Avalonia.Controls
         public static readonly StyledProperty<SizeToContent> SizeToContentProperty =
             AvaloniaProperty.Register<Window, SizeToContent>(nameof(SizeToContent));
 
-        /// <summary>
-        /// Enables or disables system window decorations (title bar, buttons, etc)
-        /// </summary>
-        [Obsolete("Use SystemDecorationsProperty instead")]
-        public static readonly DirectProperty<Window, bool> HasSystemDecorationsProperty =
-            AvaloniaProperty.RegisterDirect<Window, bool>(
-                nameof(HasSystemDecorations),
-                o => o.HasSystemDecorations,
-                (o, v) => o.HasSystemDecorations = v);
-
         /// <summary>
         /// Defines the <see cref="ExtendClientAreaToDecorationsHint"/> property.
         /// </summary>
@@ -289,25 +279,6 @@ namespace Avalonia.Controls
             set { SetValue(TitleProperty, value); }
         }
 
-        /// <summary>
-        /// Enables or disables system window decorations (title bar, buttons, etc)
-        /// </summary>
-        [Obsolete("Use SystemDecorations instead")]
-        public bool HasSystemDecorations
-        {
-            get => SystemDecorations == SystemDecorations.Full;
-            set
-            {
-                var oldValue = HasSystemDecorations;
-
-                if (oldValue != value)
-                {
-                    SystemDecorations = value ? SystemDecorations.Full : SystemDecorations.None;
-                    RaisePropertyChanged(HasSystemDecorationsProperty, oldValue, value);
-                }
-            }
-        }
-
         /// <summary>
         /// Gets or sets if the ClientArea is Extended into the Window Decorations (chrome or border).
         /// </summary>
@@ -985,9 +956,6 @@ namespace Avalonia.Controls
             Owner = null;
         }
 
-        [Obsolete("Use HandleResized(Size, PlatformResizeReason)")]
-        protected sealed override void HandleResized(Size clientSize) => HandleResized(clientSize, PlatformResizeReason.Unspecified);
-
         /// <inheritdoc/>
         protected sealed override void HandleResized(Size clientSize, PlatformResizeReason reason)
         {
@@ -1033,19 +1001,9 @@ namespace Avalonia.Controls
             base.OnPropertyChanged(change);
             if (change.Property == SystemDecorationsProperty)
             {
-                var (typedOldValue, typedNewValue) = change.GetOldAndNewValue<SystemDecorations>();
+                var (_, typedNewValue) = change.GetOldAndNewValue<SystemDecorations>();
 
                 PlatformImpl?.SetSystemDecorations(typedNewValue);
-
-                var o = typedOldValue == SystemDecorations.Full;
-                var n = typedNewValue == SystemDecorations.Full;
-
-                if (o != n)
-                {
-#pragma warning disable CS0618 // Type or member is obsolete
-                    RaisePropertyChanged(HasSystemDecorationsProperty, o, n);
-#pragma warning restore CS0618 // Type or member is obsolete
-                }
             }
         }
 

+ 0 - 9
src/Avalonia.Controls/WindowBase.cs

@@ -94,9 +94,6 @@ namespace Avalonia.Controls
         
         public Screens Screens { get; private set; }
 
-        [Obsolete("No longer used. Always returns false.")]
-        protected bool AutoSizing => false;
-
         /// <summary>
         /// Gets or sets the owner of the window.
         /// </summary>
@@ -169,9 +166,6 @@ namespace Avalonia.Controls
             }
         }
 
-        [Obsolete("No longer used. Has no effect.")]
-        protected IDisposable BeginAutoSizing() => Disposable.Empty;
-
         /// <summary>
         /// Ensures that the window is initialized.
         /// </summary>
@@ -226,9 +220,6 @@ namespace Avalonia.Controls
             }
         }
 
-        [Obsolete("Use HandleResized(Size, PlatformResizeReason)")]
-        protected override void HandleResized(Size clientSize) => HandleResized(clientSize, PlatformResizeReason.Unspecified);
-
         /// <summary>
         /// Handles a resize notification from <see cref="ITopLevelImpl.Resized"/>.
         /// </summary>

+ 13 - 10
src/Avalonia.Diagnostics/Diagnostics/Screenshots/FilePickerHandler.cs

@@ -3,6 +3,8 @@ using System.IO;
 using System.Linq;
 using System.Threading.Tasks;
 using Avalonia.Controls;
+using Avalonia.Platform.Storage;
+using Avalonia.Platform.Storage.FileIO;
 using Lifetimes = Avalonia.Controls.ApplicationLifetimes;
 
 namespace Avalonia.Diagnostics.Screenshots
@@ -59,24 +61,25 @@ namespace Avalonia.Diagnostics.Screenshots
         protected async override Task<Stream?> GetStream(IControl control)
         {
             Stream? output = default;
-            var result = await new SaveFileDialog()
+            var result = await GetWindow(control).StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
             {
+                SuggestedStartLocation = new BclStorageFolder(new DirectoryInfo(ScreenshotsRoot)),
                 Title = Title,
-                Filters = new() { new FileDialogFilter() { Name = "PNG", Extensions = new() { "png" } } },
-                Directory = ScreenshotsRoot,
-            }.ShowAsync(GetWindow(control));
-            if (!string.IsNullOrWhiteSpace(result))
+                FileTypeChoices = new FilePickerFileType[] { new FilePickerFileType("PNG") { Patterns = new string[] { "*.png" } } }
+            });
+
+            if (result!=null && !string.IsNullOrWhiteSpace(result.Name))
             {
-                var foldler = Path.GetDirectoryName(result);
+                var folder = Path.GetDirectoryName(result.Name);
                 // Directory information for path, or null if path denotes a root directory or is
                 // null. Returns System.String.Empty if path does not contain directory information.
-                if (!string.IsNullOrWhiteSpace(foldler))
+                if (!string.IsNullOrWhiteSpace(folder))
                 {
-                    if (!Directory.Exists(foldler))
+                    if (!Directory.Exists(folder))
                     {
-                        Directory.CreateDirectory(foldler);
+                        Directory.CreateDirectory(folder);
                     }
-                    output = new FileStream(result, FileMode.Create);
+                    output = new FileStream(result.Name, FileMode.Create);
                 }
             }
             return output;

+ 5 - 1
src/Avalonia.Dialogs/AboutAvaloniaDialog.xaml

@@ -76,7 +76,11 @@
     </Canvas>
     <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="18">
       <Border Height="70" Width="70">
-        <DrawingPresenter Drawing="{DynamicResource AvaloniaLogo}" />
+        <Image>
+          <Image.Source>
+            <DrawingImage Drawing="{DynamicResource AvaloniaLogo}"/>
+          </Image.Source>
+        </Image>
       </Border>
       <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,-10,0,0">
         <TextBlock Text="{Binding Version, StringFormat=Avalonia {0}}" FontSize="40" Foreground="White" />

+ 10 - 2
src/Avalonia.Themes.Fluent/Controls/ManagedFileChooser.xaml

@@ -138,7 +138,11 @@
             <ListBox.ItemTemplate>
               <DataTemplate>
                 <StackPanel Spacing="4" Orientation="Horizontal" Background="Transparent">
-                  <DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/>
+                  <Image Width="16" Height="16">
+                    <Image.Source>
+                      <DrawingImage Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/>
+                    </Image.Source>
+                  </Image>
                   <TextBlock Text="{Binding DisplayName}"/>
                 </StackPanel>
               </DataTemplate>
@@ -231,7 +235,11 @@
                       <ColumnDefinition SharedSizeGroup="Splitter" />
                       <ColumnDefinition SharedSizeGroup="Size" />
                     </Grid.ColumnDefinitions>
-                    <DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/>
+                    <Image Width="16" Height="16">
+                      <Image.Source>
+                        <DrawingImage Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/>
+                      </Image.Source>
+                    </Image>
                     <TextBlock Grid.Column="2" Text="{Binding DisplayName}"/>
                     <TextBlock Grid.Column="4" Text="{Binding Modified}" />
                     <TextBlock Grid.Column="6" Text="{Binding Type}" />

+ 1 - 1
src/Avalonia.Themes.Simple/Controls/CalendarDatePicker.xaml

@@ -118,7 +118,7 @@
 
           <Popup Name="PART_Popup"
                  PlacementTarget="{TemplateBinding}"
-                 StaysOpen="False">
+                 IsLightDismissEnabled="False">
             <Calendar Name="PART_Calendar"
                       DisplayDate="{TemplateBinding DisplayDate}"
                       DisplayDateEnd="{TemplateBinding DisplayDateEnd}"