PracticalToolkit.WPF
1.0.1
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Framework 4.6.2
This package targets .NET Framework 4.6.2. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package PracticalToolkit.WPF --version 1.0.1
NuGet\Install-Package PracticalToolkit.WPF -Version 1.0.1
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="PracticalToolkit.WPF" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PracticalToolkit.WPF --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PracticalToolkit.WPF, 1.0.1"
#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 PracticalToolkit.WPF as a Cake Addin #addin nuget:?package=PracticalToolkit.WPF&version=1.0.1 // Install PracticalToolkit.WPF as a Cake Tool #tool nuget:?package=PracticalToolkit.WPF&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Application Method
Introducing Namespaces
xmlns:s="https://github.com/zggsong/2022/xaml"
Useage
- View the Samples Project
- Below is the example code.
EnumerationExtension
Assist in quickly binding enum types to ComboBox.
<ComboBox Margin="0 5"
ItemsSource="{Binding Source={s:Enumeration {x:Type model:Fruit}}}"
SelectedValue="{Binding SelectedFruit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="Description"
SelectedValuePath="Value" />
- ViewModel
private string _password = string.Empty;
public string Password
{
get => _password;
set => SetProperty(ref _password, value);
}
- Model
public enum Fruit
{
[Description("苹果")]
Apple,
[Description("香蕉")]
Banana,
[Description("梨子")]
Pear,
[Description("桃子")]
Peach,
}
BindingProxy
This is primarily used on controls that cannot inherit DataContext, such as Popup, ContextMenu, and Tooltip, to bind to a DataContext.
<Window.Resources>
<s:BindingProxy x:Key="Vm" Data="{Binding}" />
</Window.Resources>
<ToggleButton Margin="0 5"
Name="ModeTb"
Content="点击展开" />
<Popup IsOpen="{Binding ElementName=ModeTb, Path=IsChecked}"
StaysOpen="False"
AllowsTransparency="True"
PopupAnimation="Slide"
PlacementTarget="{Binding ElementName=ModeTb}"
Placement="Bottom">
<Border CornerRadius="5"
MinWidth="80"
Background="#202020"
BorderBrush="#6ec2d2"
BorderThickness="1">
<StackPanel Background="Transparent" HorizontalAlignment="Center">
<Button Content="刷新时间1"
Margin="5"
Command="{Binding Source={StaticResource Vm}, Path=Data.Btn1Command}" />
<TextBlock Text="{Binding Source={StaticResource Vm}, Path=Data.Content}"
Margin="5" />
<Button Content="刷新时间2"
Margin="5"
Command="{Binding Source={StaticResource Vm}, Path=Data.Btn1Command}" />
<Separator />
</StackPanel>
</Border>
</Popup>
DisallowSpecialCharactersTextboxBehavior
Quickly and easily disable special characters (i.e. "\ / : ? " < > |") in these text boxes.
<TextBox Margin="5" s:DisallowSpecialCharactersTextboxBehavior.DisallowSpecialCharacters="True" />
PasswordHelper
Databind the Password Property of a WPF PasswordBox
<PasswordBox Margin="0 5"
PasswordChar="⬤"
s:PasswordHelper.Attach="True"
s:PasswordHelper.Password="{Binding Password, Mode=TwoWay}" />
PlaceholderTextBox
A text input control with placeholders.
<s:PlaceholderTextBox Placeholder="Username" />
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net7.0-windows7.0 is compatible. net8.0-windows was computed. net8.0-windows7.0 is compatible. |
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8.1
- No dependencies.
-
net6.0-windows7.0
- No dependencies.
-
net7.0-windows7.0
- No dependencies.
-
net8.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.