Chapter.WPF.Converters 1.8.0

Suggested Alternatives

Chapter.Net.WPF.Converters

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Chapter.WPF.Converters --version 1.8.0
NuGet\Install-Package Chapter.WPF.Converters -Version 1.8.0
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="Chapter.WPF.Converters" Version="1.8.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chapter.WPF.Converters --version 1.8.0
#r "nuget: Chapter.WPF.Converters, 1.8.0"
#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 Chapter.WPF.Converters as a Cake Addin
#addin nuget:?package=Chapter.WPF.Converters&version=1.8.0

// Install Chapter.WPF.Converters as a Cake Tool
#tool nuget:?package=Chapter.WPF.Converters&version=1.8.0

Chapter.WPF.Converters Library

The Chapter.WPF.Converters provides a big bunch of useful converters to be used in XAMLs for many necessities.

Features

  • BooleanToIntegerConverter: Converts an boolean to its integer representation and back.
  • BooleanToVisibilityInvertedConverter: Converts true to Visibility.Visible and false to Visibility.Collapsed.
  • CountToBooleanConverter: Converts a count to its boolean representation.
  • CountToVisibilityConverter: Converts a count to its visibility representation.
  • DateOnlyToStringConverter: Converts the given date only to a string.
  • DateTimeToStringConverter: Converts the given date time to a string.
  • DateTimeUtcConverter: Converts the given date time to universal or local time.
  • DoubleValueToThicknessConverter: Converts a value to a thickness by telling for what that value it.
  • EqualsToBooleanConverter: Equals two values and returns its result.
  • EqualsToVisibilityConverter: Equals two values and returns its visibility representation.
  • IntegerToBooleanConverter: Converts an integer to its boolean representation and back.
  • InverseBooleanConverter: Converts a boolean to is opposite.
  • IsLastItemInListConverter: Checks if the given item container is the last in the list.
  • MultiEqualsToBooleanConverter: Equals multiple values and returns its result.
  • MultiEqualsToVisibilityConverter: Equals multiple values and returns its visibility representation.
  • MultiValueToPathConverter: Combines all given strings into a path.
  • MultiValueToThicknessConverter: Creates a new thickness object by the given values.
  • NullToBooleanConverter: Converts the null or not null value to bool with an optional direction parameter.
  • NullToVisibilityConverter: Converts the null or not null value to Visibility.
  • PathToStringConverter: Converts a full path to a section from it.
  • TimeOnlyToStringConverter: Converts the given time only to a string.

Getting Started

  1. Installation:

    • Install the Chapter.WPF.Converters library via NuGet Package Manager:
    dotnet add package Chapter.WPF.Converters
    
  2. Usage:

    • Configure the converter on usage if available and needed.
    <Window>
        <Window.Resources>
            <converters:BooleanToIntegerConverter x:Key="BooleanToIntegerConverter" />
            <converters:PathToStringConverter x:Key="PathToStringConverter" Section="Directory" />
        </Window.Resources>
    </Window>
    

Example

  • Simple Usage

    <Window>
        <Window.Resources>
            <converters:BooleanToIntegerConverter x:Key="BooleanToIntegerConverter" />
        </Window.Resources>
    
        <TextBlock Text="{Binding IsChecked, Converter={StaticResource BooleanToIntegerConverter}}" />
    </Window>
    
  • Complex Usage 1

    <Window>
        <Window.Resources>
            <converters:MultiEqualsToBooleanConverter x:Key="MultiEqualsToBooleanConverter" />
        </Window.Resources>
    
        <controls:TitledItem Title="MultiEqualsToBooleanConverter">
            <StackPanel Orientation="Horizontal">
                <StackPanel>
                    <CheckBox x:Name="checked4" Content="Checked" />
                    <CheckBox x:Name="checked5" Content="Checked" />
                    <CheckBox x:Name="checked6" Content="Checked" />
                </StackPanel>
                <TextBlock Margin="10,0"
                            VerticalAlignment="Center"
                            Text="-&gt;" />
                <CheckBox VerticalAlignment="Center"
                            Content="Are Equal"
                            IsEnabled="False">
                    <CheckBox.IsChecked>
                        <MultiBinding Converter="{StaticResource MultiEqualsToBooleanConverter}">
                            <Binding ElementName="checked4" Path="IsChecked" />
                            <Binding ElementName="checked5" Path="IsChecked" />
                            <Binding ElementName="checked6" Path="IsChecked" />
                        </MultiBinding>
                    </CheckBox.IsChecked>
                </CheckBox>
            </StackPanel>
        </controls:TitledItem>
    </Window>
    
  • Complex Usage 2

    <controls:TitledItem Title="IsLastItemInListConverter">
        <DataGrid HorizontalAlignment="Left"
                    AutoGenerateColumns="False"
                    CanUserAddRows="False"
                    HeadersVisibility="Column"
                    ItemsSource="{Binding Integers}">
            <DataGrid.ItemContainerStyle>
                <Style TargetType="{x:Type DataGridRow}">
                    <Setter Property="Background" Value="White" />
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type DataGridRow}">
                                <Border Background="{TemplateBinding Background}">
                                    <DataGridCellsPresenter />
                                </Border>
                                <ControlTemplate.Triggers>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource IsLastItemInListConverter}}" Value="True">
                                        <Setter Property="Background" Value="Yellow" />
                                    </DataTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </DataGrid.ItemContainerStyle>
            <DataGrid.Columns>
                <DataGridTextColumn Width="100"
                                    Binding="{Binding Value}"
                                    Header="Value"
                                    SortMemberPath="Value" />
            </DataGrid.Columns>
        </DataGrid>
    </controls:TitledItem>
    

License

Copyright (c) David Wendland. All rights reserved.
Licensed under the MIT License. See LICENSE file in the project root for full license information.

Product Compatible and additional computed target framework versions.
.NET net7.0-windows7.0 is compatible.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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