UToolKit 1.1.1
dotnet add package UToolKit --version 1.1.1
NuGet\Install-Package UToolKit -Version 1.1.1
<PackageReference Include="UToolKit" Version="1.1.1" />
paket add UToolKit --version 1.1.1
#r "nuget: UToolKit, 1.1.1"
// Install UToolKit as a Cake Addin #addin nuget:?package=UToolKit&version=1.1.1 // Install UToolKit as a Cake Tool #tool nuget:?package=UToolKit&version=1.1.1
UToolKit
Library that contains useful tools for WPF application.
It is recommended to use this library with Fody.PropertyChanged.
Release notes:
- Added resource dictionary that contains all converters from current package. To use it check examples below.
Main features:
- ObservableObject (
INotifyPropertyChanged
implementation) - IRefreshableCommand (inherits
ICommand
, allows to callICommand.CanExecuteChanged
manually) - RelayCommand (
IRefreshableCommand
implementation) - RelayAsyncCommand (
IRefreshableCommand
async implementation) - RelaySingleTaskAsyncCommand (
IRefreshableCommand
async implementation, designed for single task execution)
Converters:
- InverseBooleanConverter
- BooleanToVisibilityConverter
- BooleanToHiddenVisibilityConverter
- InverseBooleanToHiddenVisibilityConverter
- InverseBooleanToVisibilityConverter
Extensions:
- ControlExtensions
FousMode
- focus mode forControl
. There is two modes:Default
andFocusOnLoad
.
- HyperlinkExtensions
IsExternal
- iftrue
Hyperlink will executeProcess.Start
usingHyperlink.NavigateUri
after click.
- WindowExtensions
CloseCommand
- command which executes on windows closing. IfICommand.CanExecute()
returns false - window closing will be cancalled.CloseCommandParameter
- parameter forCloseCommand
.PlacementStorageStrategy
- window placement storage strategy. There are 2 different implemented strategies,RegistryStorage
andSettingsStorage
. It is possible to implement custom strategy usingIWindowPlacementStorage
.
- RoutedCommand bindings - allows to bind
ICommand
toRoutedCommand
.
Services:
- IWindowService - (implementation: WindowService)
IsActive
- indicates whether the window is active.IsVisible
- indicates whether the window is visible.Activate()
- attempts to brind the window to the foreground and activates it.Close()
- closes window.Close(bool dialogResult)
- closes window with specified dialog result.Hide()
- hides window.Show()
- shows window.
- ITextBoxService - (implementation: TextBoxService)
- event
TextChanged
- informs that the text has changed. - event
SelectionChanged
- informs that the selection has changed. Text
- allows to get or set text toTextBox
(will not break bindings).CaretIndex
- gets current caret index.SelectionLength
- gets selected text length.SelectedText
- gets or sets selected text in text box (will not break bindings).Select(int start, int length)
- selects a range of text in text box.SelectAll()
- selects all text in text box.
- event
- IPasswordSupplier - (implementation: PasswordSupplier)
- event
PasswordChanged
- occurs when the password of thePasswordBox
changes. Password
- allows to get or set password from/toPasswordBox
.SecurePassword
- gets secure password fromPasswordBox
.Clear()
- clears all password.
- event
Getting started.
First you need to include namespace to your code or markup.
For XAML it can look like:
<Window xmlns:tk="https://github.com/nullsoftware/UToolKit" />
And for C#:
using NullSoftware;
using NullSoftware.Services;
using NullSoftware.ToolKit;
using NullSoftware.ToolKit.Converters;
using NullSoftware.ToolKit.Extensions;
Examples:
To use converters just add MergedDictionary
with source pack://application:,,,/UToolKit;component/ToolKit/Converters.xaml
in your App.xaml
:
<Application
x:Class="ExampleProject.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ExampleProject"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/UToolKit;component/ToolKit/Converters.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
How to set PlacementStorageStrategy
:
<Window xmlns:tk="https://github.com/nullsoftware/UToolKit"
xmlns:prop="clr-namespace:ExampleProject.Properties"
tk:WindowExtensions.PlacementStorageStrategy="{tk:RegistryStorage NameFormat=Placement, Hive=CurrentUser, Key='SOFTWARE\MyCompany\MyApp'}" />
or
<Window xmlns:tk="https://github.com/nullsoftware/UToolKit"
xmlns:prop="clr-namespace:ExampleProject.Properties"
tk:WindowExtensions.PlacementStorageStrategy="{tk:SettingsStorage Settings={x:Static prop:Settings.Default}}" />
How to use RoutedCommandHandlers
:
<Window xmlns:tk="https://github.com/nullsoftware/UToolKit">
<tk:RoutedCommandHandlers.Commands>
<tk:RoutedCommandHandler RoutedCommand="ApplicationCommands.Create" Command="{Binding CreateCommand}"/>
<tk:RoutedCommandHandler RoutedCommand="ApplicationCommands.Open" Command="{Binding OpenCommand}"/>
</tk:RoutedCommandHandlers.Commands>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Menu Grid.Row="0">
<MenuItem Header="_File">
<MenuItem Header="_New" Command="ApplicationCommands.Create" />
<MenuItem Header="_Open" Command="ApplicationCommands.Open" />
</MenuItem>
</Menu>
</Grid>
</Window>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net5.0-windows7.0 is compatible. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows7.0 is compatible. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net7.0-windows7.0 is compatible. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
.NET Framework | net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 was computed. |
-
.NETCoreApp 3.0
- No dependencies.
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
net5.0-windows7.0
- No dependencies.
-
net6.0-windows7.0
- No dependencies.
-
net7.0-windows7.0
- 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.1.1 | 216 | 5/17/2023 |
1.1.0.1 | 270 | 2/25/2023 |
1.1.0 | 249 | 2/24/2023 |
1.0.2 | 262 | 2/24/2023 |
1.0.1.1 | 302 | 1/28/2023 |
1.0.0.1 | 331 | 12/18/2022 |
1.0.0 | 325 | 12/16/2022 |
0.0.8.1-alpha | 169 | 12/16/2022 |
0.0.8-alpha | 170 | 12/16/2022 |
0.0.7.8-alpha | 174 | 11/12/2022 |
0.0.7.4-alpha | 199 | 8/12/2022 |
0.0.7.2-alpha | 208 | 5/11/2022 |
0.0.7.1-alpha | 184 | 5/10/2022 |
0.0.7-alpha | 192 | 5/10/2022 |
0.0.6-alpha | 200 | 4/27/2022 |
0.0.4-preview | 204 | 4/7/2022 |
0.0.3-preview | 188 | 4/7/2022 |
0.0.2-preview | 188 | 4/2/2022 |
0.0.1-preview | 194 | 4/1/2022 |
Added resource dictionary for converters