ControlR.Viewer.Avalonia
0.20.85
dotnet add package ControlR.Viewer.Avalonia --version 0.20.85
NuGet\Install-Package ControlR.Viewer.Avalonia -Version 0.20.85
<PackageReference Include="ControlR.Viewer.Avalonia" Version="0.20.85" />
<PackageVersion Include="ControlR.Viewer.Avalonia" Version="0.20.85" />
<PackageReference Include="ControlR.Viewer.Avalonia" />
paket add ControlR.Viewer.Avalonia --version 0.20.85
#r "nuget: ControlR.Viewer.Avalonia, 0.20.85"
#:package ControlR.Viewer.Avalonia@0.20.85
#addin nuget:?package=ControlR.Viewer.Avalonia&version=0.20.85
#tool nuget:?package=ControlR.Viewer.Avalonia&version=0.20.85
ControlR.Viewer.Avalonia
ControlR.Viewer.Avalonia provides the ControlrViewer control for embedding a ControlR remote viewer inside an Avalonia UI application.
Use it when you want to host a live ControlR session inside one of your existing views (not necessarily your main window).
Install
dotnet add package ControlR.Viewer.Avalonia
Requirements
Your view model must expose a ControlrViewerOptions instance containing:
BaseUrl(Uri) - Base URL of your ControlR server.DeviceId(Guid) - Device to connect to.PersonalAccessToken(string) - PAT for the connecting user.
How those values are resolved is up to your application architecture.
Usage Example
In this example, ControlrViewer is hosted in ParentView.axaml, with options provided by ParentViewModel.
ParentView.axaml
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:YourApp.ViewModels"
xmlns:ctrlr="using:ControlR.Viewer.Avalonia"
x:Class="YourApp.Views.ParentView"
x:DataType="vm:ParentViewModel">
<ctrlr:ControlrViewer Options="{Binding ViewerOptions}" />
</UserControl>
ParentViewModel.cs
using ControlR.Libraries.Viewer.Common.Options;
using Microsoft.Extensions.Options;
namespace YourApp.ViewModels;
public class ParentViewModel
{
public ParentViewModel(IOptions<ControlrViewerOptions> viewerOptions)
{
ViewerOptions = viewerOptions.Value;
}
public ControlrViewerOptions ViewerOptions { get; }
}
ViewerRegistry
The library exposes a global ViewerRegistry helper (in ControlR.Viewer.Avalonia.Services) that stores information about the ControlrViewer and IServiceProvider instances that are currently active. This allows you to interact with the viewers and their services from anywhere in your application, as long as you have the viewer's instance ID (which is a Guid).
Instances are automatically registered when a ControlrViewer is initialized and unregistered/disposed when the ControlrViewer instance is detached from the visual tree, so you don't need to manage the lifecycle manually.
Important APIs:
ViewerRegistry.Register(Guid instanceId, ControlrViewer viewer, IServiceProvider serviceProvider)— registers a viewer instance (the control registers itself automatically).ViewerRegistry.Unregister(Guid instanceId)— removes a registered instance (the control unregisters itself on disposal).ViewerRegistry.GetRequiredService<T>(Guid instanceId)— resolves a required service from a specific viewer's scope and throws if not found.ViewerRegistry.GetService<T>(Guid instanceId)— attempts to resolve a service and returns null if not found.ViewerRegistry.GetService(Guid instanceId, Type serviceType)— non-generic service resolution.ViewerRegistry.GetAllInstanceIds()— returns all currently registered viewer instance IDs.ViewerRegistry.TryGetInstance(Guid instanceId, out ControlrViewer? viewer)— attempts to get a registered viewer instance.
Example usage:
// Obtain a service from a running viewer (registration is handled by the control itself)
var remoteControlStream = ViewerRegistry.GetRequiredService<IViewerRemoteControlStream>(viewerId);
Notes
- Keep PATs out of source control.
- The
ControlrViewerwill intitialize and connect to the server once it's made visible. - Options will be validated automatically before connecting.
- If any options are missing or invalid, the control will render an error message instead.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Avalonia (>= 11.3.12)
- Avalonia.Skia (>= 11.3.12)
- Bitbound.SimpleMessenger (>= 2.4.24)
- CommunityToolkit.Diagnostics (>= 8.4.0)
- CommunityToolkit.Mvvm (>= 8.4.0)
- ControlR.ApiClient (>= 0.20.85)
- ControlR.Libraries.Avalonia (>= 0.20.85)
- ControlR.Libraries.Viewer.Common (>= 0.20.85)
- Devolutions.AvaloniaControls (>= 2026.2.23)
- Devolutions.AvaloniaTheme.DevExpress (>= 2026.2.20)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
- SkiaSharp (>= 3.119.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.20.85 | 0 | 3/4/2026 |
| 0.20.84-dev | 17 | 3/4/2026 |
| 0.20.82-dev | 34 | 3/4/2026 |