Kelary.Infrastructure 1.3.4

dotnet add package Kelary.Infrastructure --version 1.3.4                
NuGet\Install-Package Kelary.Infrastructure -Version 1.3.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kelary.Infrastructure" Version="1.3.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kelary.Infrastructure --version 1.3.4                
#r "nuget: Kelary.Infrastructure, 1.3.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Kelary.Infrastructure as a Cake Addin
#addin nuget:?package=Kelary.Infrastructure&version=1.3.4

// Install Kelary.Infrastructure as a Cake Tool
#tool nuget:?package=Kelary.Infrastructure&version=1.3.4                

Kelary Infrastructure

Nuget Version

Kelary Infrastructure provides essential infrastructure components and helpers for developing WPF applications. This library includes various utilities designed to simplify common tasks in WPF development.

Features

  • Converters: A collection of converters for common data transformations.
  • Markup Style Extensions: Enhancements to XAML markup for cleaner and more maintainable code.
  • Collections:
    • ObservableDictionary: A dictionary that notifies listeners of dynamic changes.
    • DeepObservableCollection: An observable collection that tracks changes within nested collections.
  • Services:
    • File Dialog Service: Simplifies file selection dialogs.
    • Window Navigation Service: Manages window navigation within an application.
    • Page Navigation Service: Handles navigation between pages.

Installation

You can install Kelary Infrastructure via NuGet:

dotnet add package Kelary.Infrastructure

Or through the NuGet Package Manager in Visual Studio.

Usage

Converters

Kelary Infrastructure includes various converters for common tasks. Here’s an example of how to use a converter in XAML:

<Window xmlns:infra="clr-namespace:Kelary.Infrastructure.Converters;assembly=Kelary.Infrastructure">
    <Window.Resources>
        <infra:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
    </Window.Resources>
    <Grid>
        <TextBlock Visibility="{Binding IsVisible, Converter={StaticResource BoolToVisibilityConverter}}" Text="Hello, World!"/>
    </Grid>
</Window>

ObservableDictionary

ObservableDictionary can be used in place of a regular dictionary when you need to notify listeners of changes:

using Kelary.Infrastructure.Collections;

var dictionary = new ObservableDictionary<string, string>();
dictionary.Add("key", "value");
dictionary.CollectionChanged += (s, e) => 
{
    // Handle changes
};

DeepObservableCollection

DeepObservableCollection tracks changes within nested collections:

using Kelary.Infrastructure.Collections;
using System.Collections.ObjectModel;

var nestedCollection = new DeepObservableCollection<ObservableCollection<string>>
{
    new ObservableCollection<string> { "Item1", "Item2" },
    new ObservableCollection<string> { "Item3", "Item4" }
};
nestedCollection.CollectionChanged += (s, e) =>
{
    // Handle changes
};

File Dialog Service

Simplify file dialogs with the File Dialog Service:

using Kelary.Infrastructure.Services;

var fileDialogService = new FileDialogService();
string filePath = fileDialogService.OpenFileDialog("Select a file", "Text Files|*.txt");

Window Navigation Service

Manage window navigation within your application:

using Kelary.Infrastructure.Services;
using System.Windows;

public partial class MainWindow : Window
{
    private readonly WindowNavigationService _navigationService;

    public MainWindow()
    {
        InitializeComponent();
        _navigationService = new WindowNavigationService(this);
    }

    private void OpenNewWindow()
    {
        var newWindow = new AnotherWindow();
        _navigationService.Navigate(newWindow);
    }
}

Handle page navigation within a Frame control:

using Kelary.Infrastructure.Services;
using System.Windows.Controls;

public partial class MainPage : Page
{
    private readonly PageNavigationService _navigationService;

    public MainPage()
    {
        InitializeComponent();
        _navigationService = new PageNavigationService(this.NavigationService);
    }

    private void NavigateToAnotherPage()
    {
        var anotherPage = new AnotherPage();
        _navigationService.Navigate(anotherPage);
    }
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
1.3.4 441 7/5/2021
1.3.3 606 9/9/2019
1.3.2 557 9/5/2019
1.3.1 1,053 6/23/2018
1.3.0 1,100 1/11/2018
1.2.1 1,045 9/6/2017
1.2.0 935 8/1/2017
1.0.6375.30057 1,107 6/15/2017

Added DeepObservableCollection class.