PracticalToolkit.WPF 1.0.4

dotnet add package PracticalToolkit.WPF --version 1.0.4                
NuGet\Install-Package PracticalToolkit.WPF -Version 1.0.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="PracticalToolkit.WPF" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PracticalToolkit.WPF --version 1.0.4                
#r "nuget: PracticalToolkit.WPF, 1.0.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 PracticalToolkit.WPF as a Cake Addin
#addin nuget:?package=PracticalToolkit.WPF&version=1.0.4

// Install PracticalToolkit.WPF as a Cake Tool
#tool nuget:?package=PracticalToolkit.WPF&version=1.0.4                

Application Method

Introducing Namespaces

xmlns:s="https://github.com/zggsong/2022/xaml"
<ResourceDictionary Source="pack://application:,,,/PracticalToolkit.WPF;component/Themes/Generic.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"
    s:PasswordHelper.Attach="True"
    s:PasswordHelper.Password="{Binding Password, Mode=TwoWay}" />

PlaceholderTextBox

A text input control with placeholders.

<s:PlaceholderTextBox Placeholder="Username" />

PasswordBoxMarkTextStyle

Support password box to display binding watermark information by Tag Required to work with PasswordHelper

<PasswordBox Margin="0 5"
    Style="{DynamicResource PasswordBoxMarkTextStyle}"
    Tag="输入你的密码"
    s:PasswordHelper.Attach="True"
    s:PasswordHelper.Password="{Binding PasswordMarkText, Mode=TwoWay}" />

TextBoxRoundedStyle

Rounded text box style

<TextBox Margin="0 5" Style="{DynamicResource TextBoxRoundedStyle}" />

NumericUpDown

<s:NumericUpDown Minimum="0"
    Maximum="50"
    Step="5"
    FontSize="14"
    IconSize="14"
    Tag="请输入数字..." />
Product 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.

Version Downloads Last updated
1.0.4 108 7/15/2024
1.0.3 89 7/15/2024
1.0.2 87 7/12/2024
1.0.1 104 7/8/2024
1.0.0 87 7/8/2024