Common ReactiveUI MVVM Level Interactions(like open/save file) for WPF/UWP/Uno platform ⭐ Last 10 features: - feat: Updated NuGet packages. 2021-12-22 - feat: Updated Uno to 4.0.11. 2021-12-15 - feat: Added GenerateDocumentationFile true to Core library with some docs. 2021-12-11 - feat(Avalonia): Added support for FileInteractions arguments. 2021-12-09 - feat(Avalonia): Added FileInteractions support. 2021-12-09 - feat: Added Avalonia support. 2021-12-09 - feat(apps.WinUI): to 18362. 2021-12-08 - feat: Updated README. 2021-12-05 - feat: Updated NuGet packages. 2021-12-05 - feat: Added logging. 2021-12-05 🐞 Last 10 bug fixes: - fix(Avalonia): Changed BaseConverter null values to UnsetValue. 2021-12-15 - fix(Avalonia): Fixed OpenFileDialog Filters bug. 2021-12-11 - fix: Fixed CI to release avalonia. 2021-12-10 - fix(apps.Avalonia): Fixed FileInteractions. 2021-12-09 - fix(apps.Avalonia): Fixed designer problems. 2021-12-09 - fix(apps.Avalonia): Added InteractionManager.Register. 2021-12-09 - fix: Changed Uwp TargetFramework to uap10.0.18362. 2021-12-05 - fix(Uno.WinUI): Fixed issues from WinUI. 2021-11-19 - fix: Fixed CI. 2021-11-18 - fix: Fixed missing Core NuGet package. 2021-11-05
Install
| Product | Versions |
|---|---|
| .NET Standard | |
| Other |
README
H.ReactiveUI.CommonInteractions
Common ReactiveUI MVVM Level Interactions(like open/save file) for WPF/UWP/Uno platform.
NuGet
Install-Package H.ReactiveUI.CommonInteractions.Core
Install-Package H.ReactiveUI.CommonInteractions.Wpf
Install-Package H.ReactiveUI.CommonInteractions.Uno
Install-Package H.ReactiveUI.CommonInteractions.Uwp
Usage
Add to your App constructors:
public sealed partial class App
{
private InteractionManager InteractionManager { get; } = new();
public App()
{
InteractionManager.Register();
// Not necessary. Displays unhandled exceptions using MessageInteractions.Exception.
// InteractionManager.CatchUnhandledExceptions();
// your code
}
}
FileInteractions
// Open
var file = await FileInteractions.OpenFile.Handle(new OpenFileArguments
{
SuggestedFileName = "my.txt",
Extensions = new[] { ".txt" },
FilterName = "My txt files",
});
if (file == null)
{
return;
}
var text = await file.ReadTextAsync().ConfigureAwait(true);
// Save (you need to save file from previuos step)
await file.WriteTextAsync(text).ConfigureAwait(false);
// Save As
var file = await FileInteractions.SaveFile.Handle(new SaveFileArguments(".txt")
{
SuggestedFileName = "my.txt",
FilterName = "My txt files",
});
if (file == null)
{
return;
}
await file.WriteTextAsync(text).ConfigureAwait(false);
MessageInteractions
WinUI requires a window to display the ContentDialog, so you'll need to set it explicitly in your App.OnLaunched:
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
#if HAS_WINUI
var window = new Window();
MessageInteractionManager.Window = window;
#endif
}
DragAndDropExtensions
// WPF
xmlns:h="clr-namespace:H.ReactiveUI;assembly=H.ReactiveUI.CommonInteractions.Wpf"
// UWP/Uno
xmlns:h="using:H.ReactiveUI"
<Element
AllowDrop="True"
h:DragAndDropExtensions.DragFilesEnterCommand="{Binding DragFilesEnter}"
h:DragAndDropExtensions.DragTextEnterCommand="{Binding DragTextEnter}"
h:DragAndDropExtensions.DragLeaveCommand="{Binding DragLeave}"
h:DragAndDropExtensions.DropFilesCommand="{Binding DropFiles}"
h:DragAndDropExtensions.DropTextCommand="{Binding DropText}"
>
Command arguments:
DragFilesEnterCommand - FileData[] - Array of files.
DragTextEnterCommand - string - Text.
DragLeaveCommand - null.
DropFilesCommand - FileData[] - Array of files.
DropTextCommand - string - Text.
Contacts
Changes from Previous Version
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.