Kelary.Infrastructure
1.3.4
dotnet add package Kelary.Infrastructure --version 1.3.4
NuGet\Install-Package Kelary.Infrastructure -Version 1.3.4
<PackageReference Include="Kelary.Infrastructure" Version="1.3.4" />
paket add Kelary.Infrastructure --version 1.3.4
#r "nuget: Kelary.Infrastructure, 1.3.4"
// 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
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);
}
}
Page Navigation Service
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 | Versions 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. |
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.
Added DeepObservableCollection class.