diff --git a/.gitmodules b/.gitmodules index 9c58db0b3a..07f532607a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "XamlX"] path = external/XamlX url = https://github.com/kekekeks/XamlX.git -[submodule "Avalonia.Controls.DataGrid"] - path = external/Avalonia.Controls.DataGrid - url = https://github.com/AvaloniaUI/Avalonia.Controls.DataGrid.git diff --git a/Avalonia.sln b/Avalonia.sln index 663f8c3319..287805a8a9 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Controls", "src\Av EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Themes.Simple", "src\Avalonia.Themes.Simple\Avalonia.Themes.Simple.csproj", "{3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Diagnostics", "src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj", "{7062AE20-5DCC-4442-9645-8195BDECE63E}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Controls.UnitTests", "tests\Avalonia.Controls.UnitTests\Avalonia.Controls.UnitTests.csproj", "{5CCB5571-7C30-4E7D-967D-0E2158EBD91F}" @@ -309,10 +307,6 @@ Global {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E10A5FA-E8DA-48B1-AD44-6A5B6CB7750F}.Release|Any CPU.Build.0 = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7062AE20-5DCC-4442-9645-8195BDECE63E}.Release|Any CPU.Build.0 = Release|Any CPU {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5CCB5571-7C30-4E7D-967D-0E2158EBD91F}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/build/SampleApp.props b/build/SampleApp.props index 8ecbe902ab..3f44553d2d 100644 --- a/build/SampleApp.props +++ b/build/SampleApp.props @@ -13,6 +13,10 @@ + + + + - diff --git a/samples/AppWithoutLifetime/MainWindow.axaml.cs b/samples/AppWithoutLifetime/MainWindow.axaml.cs index df3ed3cea0..a92bd31600 100644 --- a/samples/AppWithoutLifetime/MainWindow.axaml.cs +++ b/samples/AppWithoutLifetime/MainWindow.axaml.cs @@ -1,4 +1,3 @@ -using Avalonia; using Avalonia.Controls; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; @@ -17,13 +16,6 @@ public partial class MainWindow : Window AvaloniaXamlLoader.Load(this); } - /// - protected override void OnLoaded(RoutedEventArgs e) - { - this.AttachDevTools(); - base.OnLoaded(e); - } - public void Open(object sender, RoutedEventArgs e) { new Sub().Show(this); diff --git a/samples/AppWithoutLifetime/Program.cs b/samples/AppWithoutLifetime/Program.cs index 9404b9f01a..60ab32824e 100644 --- a/samples/AppWithoutLifetime/Program.cs +++ b/samples/AppWithoutLifetime/Program.cs @@ -24,5 +24,6 @@ class Program public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() + .WithDeveloperTools() .LogToTrace(); } diff --git a/samples/AppWithoutLifetime/Sub.axaml.cs b/samples/AppWithoutLifetime/Sub.axaml.cs index 3a7ce787bc..e0d07fb338 100644 --- a/samples/AppWithoutLifetime/Sub.axaml.cs +++ b/samples/AppWithoutLifetime/Sub.axaml.cs @@ -1,6 +1,4 @@ -using Avalonia; using Avalonia.Controls; -using Avalonia.Interactivity; using Avalonia.Markup.Xaml; namespace AppWithoutLifetime; @@ -16,11 +14,4 @@ public partial class Sub : Window { AvaloniaXamlLoader.Load(this); } - - /// - protected override void OnLoaded(RoutedEventArgs e) - { - this.AttachDevTools(); - base.OnLoaded(e); - } } diff --git a/samples/BindingDemo/App.xaml.cs b/samples/BindingDemo/App.xaml.cs index 8a5364c70b..e76f61ac63 100644 --- a/samples/BindingDemo/App.xaml.cs +++ b/samples/BindingDemo/App.xaml.cs @@ -24,6 +24,7 @@ namespace BindingDemo public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() + .WithDeveloperTools() .LogToTrace(); } } diff --git a/samples/BindingDemo/BindingDemo.csproj b/samples/BindingDemo/BindingDemo.csproj index 33c6aa1440..b12e350814 100644 --- a/samples/BindingDemo/BindingDemo.csproj +++ b/samples/BindingDemo/BindingDemo.csproj @@ -5,7 +5,6 @@ - diff --git a/samples/BindingDemo/MainWindow.xaml.cs b/samples/BindingDemo/MainWindow.xaml.cs index 36d4feb108..6a7c1e877d 100644 --- a/samples/BindingDemo/MainWindow.xaml.cs +++ b/samples/BindingDemo/MainWindow.xaml.cs @@ -1,5 +1,4 @@ using BindingDemo.ViewModels; -using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; @@ -12,7 +11,6 @@ namespace BindingDemo Resources["SharedItem"] = new MainWindowViewModel.TestItem() { Value = "shared" }; this.InitializeComponent(); this.DataContext = new MainWindowViewModel(); - this.AttachDevTools(); } private void InitializeComponent() diff --git a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj index 9398987837..c951862ad2 100644 --- a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj +++ b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj @@ -20,7 +20,6 @@ - diff --git a/samples/ControlCatalog.Desktop/Program.cs b/samples/ControlCatalog.Desktop/Program.cs index bf766cba8d..c4c42a7311 100644 --- a/samples/ControlCatalog.Desktop/Program.cs +++ b/samples/ControlCatalog.Desktop/Program.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Fonts.Inter; using Avalonia.Headless; using Avalonia.LinuxFramebuffer.Output; using Avalonia.LogicalTree; @@ -149,16 +148,9 @@ namespace ControlCatalog.Desktop }) .UseSkia() .WithInterFont() + .WithDeveloperTools() .AfterSetup(builder => { - if (!s_useFramebuffer) - { - builder.Instance!.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() - { - StartupScreenIndex = 1, - }); - } - EmbedSample.Implementation = OperatingSystem.IsWindows() ? (INativeDemoControl)new EmbedSampleWin() : OperatingSystem.IsMacOS() ? new EmbedSampleMac() : OperatingSystem.IsLinux() ? new EmbedSampleGtk() diff --git a/samples/GpuInterop/GpuInterop.csproj b/samples/GpuInterop/GpuInterop.csproj index 257ebf89de..d952e60524 100644 --- a/samples/GpuInterop/GpuInterop.csproj +++ b/samples/GpuInterop/GpuInterop.csproj @@ -15,7 +15,6 @@ - diff --git a/samples/GpuInterop/MainWindow.axaml.cs b/samples/GpuInterop/MainWindow.axaml.cs index 0cb3732b74..b0a719b95f 100644 --- a/samples/GpuInterop/MainWindow.axaml.cs +++ b/samples/GpuInterop/MainWindow.axaml.cs @@ -30,7 +30,6 @@ namespace GpuInterop } }; - this.AttachDevTools(); RendererDiagnostics.DebugOverlays = RendererDebugOverlays.Fps; } diff --git a/samples/GpuInterop/Program.cs b/samples/GpuInterop/Program.cs index ef1b9c8951..46cf738304 100644 --- a/samples/GpuInterop/Program.cs +++ b/samples/GpuInterop/Program.cs @@ -34,6 +34,7 @@ namespace GpuInterop UseDebug = true } }) + .WithDeveloperTools() .LogToTrace(LogEventLevel.Debug, "Vulkan"); } } diff --git a/samples/IntegrationTestApp/IntegrationTestApp.csproj b/samples/IntegrationTestApp/IntegrationTestApp.csproj index c117111651..7e45643843 100644 --- a/samples/IntegrationTestApp/IntegrationTestApp.csproj +++ b/samples/IntegrationTestApp/IntegrationTestApp.csproj @@ -24,7 +24,6 @@ - diff --git a/samples/IntegrationTestApp/Program.cs b/samples/IntegrationTestApp/Program.cs index 43c936bb1c..29b7557f6a 100644 --- a/samples/IntegrationTestApp/Program.cs +++ b/samples/IntegrationTestApp/Program.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using Avalonia; using IntegrationTestApp.Embedding; @@ -32,6 +31,7 @@ namespace IntegrationTestApp public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() + .WithDeveloperTools() .AfterSetup(builder => { NativeTextBox.Factory = diff --git a/samples/RenderDemo/App.xaml.cs b/samples/RenderDemo/App.xaml.cs index 8054b06964..e08c48475b 100644 --- a/samples/RenderDemo/App.xaml.cs +++ b/samples/RenderDemo/App.xaml.cs @@ -31,6 +31,7 @@ namespace RenderDemo OverlayPopups = true, }) .UsePlatformDetect() + .WithDeveloperTools() .LogToTrace(); } } diff --git a/samples/RenderDemo/MainWindow.xaml.cs b/samples/RenderDemo/MainWindow.xaml.cs index be47ffd6e9..a2f3f0eac8 100644 --- a/samples/RenderDemo/MainWindow.xaml.cs +++ b/samples/RenderDemo/MainWindow.xaml.cs @@ -1,6 +1,5 @@ using System; using System.Linq.Expressions; -using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.Rendering; @@ -14,7 +13,6 @@ namespace RenderDemo public MainWindow() { InitializeComponent(); - this.AttachDevTools(); var vm = new MainWindowViewModel(); diff --git a/samples/RenderDemo/RenderDemo.csproj b/samples/RenderDemo/RenderDemo.csproj index 648f7d3e0c..ef6e46dedd 100644 --- a/samples/RenderDemo/RenderDemo.csproj +++ b/samples/RenderDemo/RenderDemo.csproj @@ -11,7 +11,6 @@ - diff --git a/samples/SafeAreaDemo.Desktop/Program.cs b/samples/SafeAreaDemo.Desktop/Program.cs index b07682e8c8..05593b3313 100644 --- a/samples/SafeAreaDemo.Desktop/Program.cs +++ b/samples/SafeAreaDemo.Desktop/Program.cs @@ -16,6 +16,7 @@ namespace SafeAreaDemo.Desktop public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() + .WithDeveloperTools() .LogToTrace(); } } diff --git a/samples/SafeAreaDemo.Desktop/SafeAreaDemo.Desktop.csproj b/samples/SafeAreaDemo.Desktop/SafeAreaDemo.Desktop.csproj index e633b723a5..e2fca22929 100644 --- a/samples/SafeAreaDemo.Desktop/SafeAreaDemo.Desktop.csproj +++ b/samples/SafeAreaDemo.Desktop/SafeAreaDemo.Desktop.csproj @@ -9,7 +9,6 @@ - diff --git a/samples/Sandbox/Program.cs b/samples/Sandbox/Program.cs index 52321b46a9..b676992111 100644 --- a/samples/Sandbox/Program.cs +++ b/samples/Sandbox/Program.cs @@ -10,6 +10,7 @@ namespace Sandbox public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() + .WithDeveloperTools() .LogToTrace(); } } diff --git a/samples/Sandbox/Sandbox.csproj b/samples/Sandbox/Sandbox.csproj index 571149950f..e372366391 100644 --- a/samples/Sandbox/Sandbox.csproj +++ b/samples/Sandbox/Sandbox.csproj @@ -9,7 +9,6 @@ - diff --git a/samples/TextTestApp/Program.cs b/samples/TextTestApp/Program.cs index c3f4de5d3e..e3931f97d8 100644 --- a/samples/TextTestApp/Program.cs +++ b/samples/TextTestApp/Program.cs @@ -22,8 +22,9 @@ namespace TextTestApp public static AppBuilder BuildAvaloniaApp() { return AppBuilder.Configure() - .UsePlatformDetect() - .LogToTrace(); + .UsePlatformDetect() + .WithDeveloperTools() + .LogToTrace(); } } } diff --git a/samples/TextTestApp/TextTestApp.csproj b/samples/TextTestApp/TextTestApp.csproj index 41c0492cf6..c960529f76 100644 --- a/samples/TextTestApp/TextTestApp.csproj +++ b/samples/TextTestApp/TextTestApp.csproj @@ -9,7 +9,6 @@ - diff --git a/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext/MainWindow.axaml.cs b/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext/MainWindow.axaml.cs index aee3a60a01..8e9c390c94 100644 --- a/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext/MainWindow.axaml.cs +++ b/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext/MainWindow.axaml.cs @@ -29,10 +29,6 @@ public partial class MainWindow : Window private void InitializeComponent() { AvaloniaXamlLoader.Load(this); - if (Debugger.IsAttached) - { - this.AttachDevTools(); - } } private PlugTool? _plugTool; protected override void OnOpened(EventArgs e) diff --git a/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext.csproj b/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext.csproj index 23c4d7e08b..dfde281781 100644 --- a/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext.csproj +++ b/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContext.csproj @@ -23,7 +23,6 @@ - diff --git a/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContextPlug/UnloadableAssemblyLoadContextPlug.csproj b/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContextPlug/UnloadableAssemblyLoadContextPlug.csproj index 6329444078..0fd79cf3eb 100644 --- a/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContextPlug/UnloadableAssemblyLoadContextPlug.csproj +++ b/samples/UnloadableAssemblyLoadContext/UnloadableAssemblyLoadContextPlug/UnloadableAssemblyLoadContextPlug.csproj @@ -32,7 +32,6 @@ - diff --git a/samples/VirtualizationDemo/MainWindow.axaml.cs b/samples/VirtualizationDemo/MainWindow.axaml.cs index 533dc00aa1..e725603b7e 100644 --- a/samples/VirtualizationDemo/MainWindow.axaml.cs +++ b/samples/VirtualizationDemo/MainWindow.axaml.cs @@ -1,4 +1,3 @@ -using Avalonia; using Avalonia.Controls; using VirtualizationDemo.ViewModels; @@ -9,7 +8,6 @@ public partial class MainWindow : Window public MainWindow() { InitializeComponent(); - this.AttachDevTools(); DataContext = new MainWindowViewModel(); } } diff --git a/samples/VirtualizationDemo/Program.cs b/samples/VirtualizationDemo/Program.cs index 87212b6daa..dd289b3b25 100644 --- a/samples/VirtualizationDemo/Program.cs +++ b/samples/VirtualizationDemo/Program.cs @@ -7,6 +7,7 @@ class Program public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() + .WithDeveloperTools() .LogToTrace(); public static int Main(string[] args) diff --git a/samples/VirtualizationDemo/VirtualizationDemo.csproj b/samples/VirtualizationDemo/VirtualizationDemo.csproj index 32bc379f42..ee0fe7c6a1 100644 --- a/samples/VirtualizationDemo/VirtualizationDemo.csproj +++ b/samples/VirtualizationDemo/VirtualizationDemo.csproj @@ -6,8 +6,6 @@ - - @@ -18,6 +16,7 @@ PreserveNewest + diff --git a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj index 5cb227f9cb..576910ca3d 100644 --- a/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj +++ b/samples/interop/WindowsInteropTest/WindowsInteropTest.csproj @@ -8,7 +8,6 @@ - diff --git a/src/Avalonia.Diagnostics/Assets/Fonts/SourceSansPro-Regular.ttf b/src/Avalonia.Diagnostics/Assets/Fonts/SourceSansPro-Regular.ttf deleted file mode 100644 index 278ad8aa0a..0000000000 Binary files a/src/Avalonia.Diagnostics/Assets/Fonts/SourceSansPro-Regular.ttf and /dev/null differ diff --git a/src/Avalonia.Diagnostics/Assets/Icons.axaml b/src/Avalonia.Diagnostics/Assets/Icons.axaml deleted file mode 100644 index f1162855c1..0000000000 --- a/src/Avalonia.Diagnostics/Assets/Icons.axaml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj deleted file mode 100644 index e4da3939b3..0000000000 --- a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - $(AvsCurrentTargetFramework);$(AvsLegacyTargetFrameworks) - Avalonia - $(DefineConstants);DATAGRID_INTERNAL - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Avalonia.Diagnostics/DevToolsExtensions.cs b/src/Avalonia.Diagnostics/DevToolsExtensions.cs deleted file mode 100644 index 68deaf8335..0000000000 --- a/src/Avalonia.Diagnostics/DevToolsExtensions.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Diagnostics; -using Avalonia.Input; - -namespace Avalonia -{ - /// - /// Extension methods for attaching DevTools.. - /// - public static class DevToolsExtensions - { - /// - /// Attaches DevTools to a window, to be opened with the F12 key. - /// - /// The window to attach DevTools to. - public static void AttachDevTools(this TopLevel root) - { - DevTools.Attach(root, new DevToolsOptions()); - } - - /// - /// Attaches DevTools to a window, to be opened with the specified key gesture. - /// - /// The window to attach DevTools to. - /// The key gesture to open DevTools. - public static void AttachDevTools(this TopLevel root, KeyGesture gesture) - { - DevTools.Attach(root, gesture); - } - - /// - /// Attaches DevTools to a window, to be opened with the specified options. - /// - /// The window to attach DevTools to. - /// Additional settings of DevTools. - public static void AttachDevTools(this TopLevel root, DevToolsOptions options) - { - DevTools.Attach(root, options); - } - - /// - /// Attaches DevTools to a Application, to be opened with the specified options. - /// - /// The Application to attach DevTools to. - public static void AttachDevTools(this Application application) - { - DevTools.Attach(application, new DevToolsOptions()); - } - - /// - /// Attaches DevTools to a Application, to be opened with the specified options. - /// - /// The Application to attach DevTools to. - /// Additional settings of DevTools. - /// - /// Attach DevTools should only be called after application initialization is complete. A good point is - /// - /// - /// - /// public class App : Application - /// { - /// public override void OnFrameworkInitializationCompleted() - /// { - /// if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime) - /// { - /// desktopLifetime.MainWindow = new MainWindow(); - /// } - /// else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewLifetime) - /// singleViewLifetime.MainView = new MainView(); - /// - /// base.OnFrameworkInitializationCompleted(); - /// this.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() - /// { - /// StartupScreenIndex = 1, - /// }); - /// } - /// } - /// - /// - public static void AttachDevTools(this Application application, DevToolsOptions options) - { - DevTools.Attach(application, options); - } - } -} diff --git a/src/Avalonia.Diagnostics/Diagnostics/Behaviors/ColumnDefinition.cs b/src/Avalonia.Diagnostics/Diagnostics/Behaviors/ColumnDefinition.cs deleted file mode 100644 index beccf022d7..0000000000 --- a/src/Avalonia.Diagnostics/Diagnostics/Behaviors/ColumnDefinition.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Avalonia.Diagnostics.Behaviors -{ - /// - /// See discussion https://github.com/AvaloniaUI/Avalonia/discussions/6773 - /// - static class ColumnDefinition - { - private readonly static Avalonia.Controls.GridLength ZeroWidth = - new Avalonia.Controls.GridLength(0, Avalonia.Controls.GridUnitType.Pixel); - - private readonly static AttachedProperty LastWidthProperty = - AvaloniaProperty.RegisterAttached("LastWidth" - , typeof(ColumnDefinition) - , default); - - public readonly static AttachedProperty IsVisibleProperty = - AvaloniaProperty.RegisterAttached("IsVisible" - , typeof(ColumnDefinition) - , true - , coerce: (element, visibility) => - { - - var lastWidth = element.GetValue(LastWidthProperty); - if (visibility == true && lastWidth is { }) - { - element.SetValue(Avalonia.Controls.ColumnDefinition.WidthProperty, lastWidth); - } - else if (visibility == false) - { - element.SetValue(LastWidthProperty, element.GetValue(Avalonia.Controls.ColumnDefinition.WidthProperty)); - element.SetValue(Avalonia.Controls.ColumnDefinition.WidthProperty, ZeroWidth); - } - return visibility; - } - ); - - public static bool GetIsVisible(Avalonia.Controls.ColumnDefinition columnDefinition) - { - return columnDefinition.GetValue(IsVisibleProperty); - } - - public static void SetIsVisible(Avalonia.Controls.ColumnDefinition columnDefinition, bool visibility) - { - columnDefinition.SetValue(IsVisibleProperty, visibility); - } - } -} diff --git a/src/Avalonia.Diagnostics/Diagnostics/Controls/Application.cs b/src/Avalonia.Diagnostics/Diagnostics/Controls/Application.cs deleted file mode 100644 index 06dbb7d50e..0000000000 --- a/src/Avalonia.Diagnostics/Diagnostics/Controls/Application.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using Avalonia.Controls; -using Avalonia.Styling; -using Lifetimes = Avalonia.Controls.ApplicationLifetimes; - -namespace Avalonia.Diagnostics.Controls -{ - internal class Application : TopLevelGroup - , Input.ICloseable, IDisposable - - { - private readonly Avalonia.Application _application; - - public event EventHandler? Closed; - - public static readonly StyledProperty RequestedThemeVariantProperty = - ThemeVariantScope.RequestedThemeVariantProperty.AddOwner(); - - public Application(ClassicDesktopStyleApplicationLifetimeTopLevelGroup group, Avalonia.Application application) - : base(group) - { - _application = application; - - if (_application.ApplicationLifetime is Lifetimes.IControlledApplicationLifetime controller) - { - EventHandler eh = default!; - eh = (s, e) => - { - controller.Exit -= eh; - Closed?.Invoke(s, e); - }; - controller.Exit += eh; - } - RendererRoot = application.ApplicationLifetime switch - { - Lifetimes.IClassicDesktopStyleApplicationLifetime classic => classic.MainWindow?.Renderer, - Lifetimes.ISingleViewApplicationLifetime single => single.MainView?.VisualRoot?.Renderer, - _ => null - }; - - SetCurrentValue(RequestedThemeVariantProperty, application.RequestedThemeVariant); - _application.PropertyChanged += ApplicationOnPropertyChanged; - } - - internal Avalonia.Application Instance => _application; - - /// - /// Defines the property. - /// - public object? DataContext => - _application.DataContext; - - /// - /// Gets or sets the application's global data templates. - /// - /// - /// The application's global data templates. - /// - public Avalonia.Controls.Templates.DataTemplates DataTemplates => - _application.DataTemplates; - - /// - /// Gets the application's input manager. - /// - /// - /// The application's input manager. - /// - public Input.InputManager? InputManager => - _application.InputManager; - - /// - /// Gets the application's global resource dictionary. - /// - public IResourceDictionary Resources => - _application.Resources; - - /// - /// Gets the application's global styles. - /// - /// - /// The application's global styles. - /// - /// - /// Global styles apply to all windows in the application. - /// - public Styling.Styles Styles => - _application.Styles; - - /// - /// Application lifetime, use it for things like setting the main window and exiting the app from code - /// Currently supported lifetimes are: - /// - - /// - - /// - - /// - public Lifetimes.IApplicationLifetime? ApplicationLifetime => - _application.ApplicationLifetime; - - /// - /// Application name to be used for various platform-specific purposes - /// - public string? Name => - _application.Name; - - /// - /// Gets the root of the visual tree, if the control is attached to a visual tree. - /// - internal Rendering.IRenderer? RendererRoot { get; } - - /// - public ThemeVariant? RequestedThemeVariant - { - get => GetValue(RequestedThemeVariantProperty); - set => SetValue(RequestedThemeVariantProperty, value); - } - - public void Dispose() - { - _application.PropertyChanged -= ApplicationOnPropertyChanged; - } - - private void ApplicationOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) - { - if (e.Property == Avalonia.Application.RequestedThemeVariantProperty) - { - SetCurrentValue(RequestedThemeVariantProperty, e.GetNewValue()); - } - } - - protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) - { - base.OnPropertyChanged(change); - - if (change.Property == RequestedThemeVariantProperty) - { - _application.RequestedThemeVariant = change.GetNewValue(); - } - } - } -} diff --git a/src/Avalonia.Diagnostics/Diagnostics/Controls/BrushEditor.axaml b/src/Avalonia.Diagnostics/Diagnostics/Controls/BrushEditor.axaml deleted file mode 100644 index 7162be888f..0000000000 --- a/src/Avalonia.Diagnostics/Diagnostics/Controls/BrushEditor.axaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - diff --git a/src/Avalonia.Diagnostics/Diagnostics/Controls/BrushEditor.axaml.cs b/src/Avalonia.Diagnostics/Diagnostics/Controls/BrushEditor.axaml.cs deleted file mode 100644 index 40412a6373..0000000000 --- a/src/Avalonia.Diagnostics/Diagnostics/Controls/BrushEditor.axaml.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Globalization; -using Avalonia.Controls; -using Avalonia.Controls.Metadata; -using Avalonia.Controls.Primitives; -using Avalonia.Input; -using Avalonia.Interactivity; -using Avalonia.Media; -using Avalonia.Media.Immutable; - -namespace Avalonia.Diagnostics.Controls -{ - [TemplatePart("PART_ClearButton", typeof(Button))] - partial class BrushEditor : TemplatedControl - { - private readonly EventHandler clearHandler; - private Button? _clearButton = default; - private readonly ColorView _colorView = new() - { - HexInputAlphaPosition = AlphaComponentPosition.Leading, // Always match XAML - }; - - public BrushEditor() - { - FlyoutBase.SetAttachedFlyout(this, new Flyout { Content = _colorView }); - _colorView.ColorChanged += (_, e) => - { - // Avoid unnecessary value setters by checking if color was actually changed. - if (Brush is null || Brush is not ISolidColorBrush oldSolidBrush || oldSolidBrush.Color != e.NewColor) - { - Brush = new ImmutableSolidColorBrush(e.NewColor); - } - }; - clearHandler = (s, e) => Brush = default; - } - - protected override Type StyleKeyOverride => typeof(BrushEditor); - - protected override void OnApplyTemplate(TemplateAppliedEventArgs e) - { - base.OnApplyTemplate(e); - if (_clearButton is not null) - { - _clearButton.Click -= clearHandler; - } - _clearButton = e.NameScope.Find