Skip to content

Use new Accelerate Dev Tools #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,21 @@ Custom Avalonia Themes developed by [Devolutions](https://devolutions.net/)

➡️ [DevExpress Theme](https://github.com/Devolutions/avalonia-themes/blob/master/src/Devolutions.AvaloniaTheme.DevExpress/README.md)

➡️ [Linux Theme](https://github.com/Devolutions/avalonia-themes/blob/master/src/Devolutions.AvaloniaTheme.Linux/README.md)

# Sample App

Contributers can use the SampleApp to test, debug and document styles for the various controls under each theme.

## Debugging

The SampleApp attaches the Avalonia Dev Tools for inspecting controls (open with F12).

If you own a licence for the new Dev Tools in _Avalonia Accelerate_, you can set an environment variable in your IDE's debug configuration.
For example, in Rider:

- Open **Run > Edit Configurations**
- Pick your configuration for the SampleApp
- In the **Environment Variables** field add `USE_AVALONIA_ACCELERATE_TOOLS=true`

The F12 key then opens the new Dev Tools, and F10 opens the old version
2 changes: 1 addition & 1 deletion samples/SampleApp/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class App : Application
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);

if (!Avalonia.Controls.Design.IsDesignMode)
{
Styles.Clear();
Expand Down
17 changes: 16 additions & 1 deletion samples/SampleApp/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Styling;

namespace SampleApp;
Expand All @@ -11,7 +13,20 @@ public MainWindow()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
bool useAccelerate = Environment.GetEnvironmentVariable("USE_AVALONIA_ACCELERATE_TOOLS")?.ToLowerInvariant() == "true";

if (useAccelerate)
{
// Enable Accelerate dev tools (AvaloniaUI.DiagnosticsSupport) - requiring a licence to use
(Application.Current as App)?.AttachDeveloperTools();
// Enable original free dev tools (Avalonia.Diagnostics) as an additional option available on F10
this.AttachDevTools(new KeyGesture(Key.F10));
}
else
{
// Enable original free dev tools (Avalonia.Diagnostics)
this.AttachDevTools();
}
#endif
}

Expand Down
16 changes: 14 additions & 2 deletions samples/SampleApp/SampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,27 @@
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<!-- Prevent automatic attachment of regular free dev tools to avoid duplicate mapping of F12 key -->
<AvaloniaNameGeneratorAttachDevTools>false</AvaloniaNameGeneratorAttachDevTools>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.0" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.3.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.0" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.0" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.0" />
</ItemGroup>

<ItemGroup>
<!--Add both, Classic and Accelerate Dev Tools -->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.0" />
<PackageReference Include="AvaloniaUI.DiagnosticsSupport" Version="2.0.3" >
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Svg.Skia" Version="11.3.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0"/>
Expand Down