LogarithmicConverter Class
- Namespace
TXTextControl.WPF
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WPF. SDK
- Assembly
TXTextControl.WPF. dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WPF. SDK TXTextControl.from the setup.WPF. dll
- Implements
- IValue
Converter
Description
The class WPF.LogarithmicConverter converts a numeric value from a linear scale to a logarithmic scale. It can be used to provide better usability when mapping a zoom factor to a slider, for example. The range of values of the linear as well as the logarithmic scale have to be defined with the given "Minimum"- and "Maximum"-properties. Provides a possibility to define an input value which should be mapped to the center of the output range of values. The class can be used in XAML as a static resource to automatically convert bound property values.
Syntax
public class LogarithmicConverter : IValueConverterPublic Class LogarithmicConverter
Implements IValueConverterExamples
The following XAML example shows how to bind the TextControl.ZoomFactor property to a slider using the LogarithmicConverter mapping a zoom range from 10 to 400 percent to a value range from 0 to 100.
…
xmlns:tx="clr-namespace:TXTextControl.WPF;assembly=TXTextControl.WPF"
…
<Window.Resources>
<tx:LogarithmicConverter
x:Key="logConv"
InputMinimum="10"
InputCenter="100"
InputMaximum="400"
OutputMinimum="0"
OutputMaximum="100" />
</Window.Resources>
…
<Slider
Minimum="0"
Maximum="100"
Value="{Binding ElementName=textControl1, Path=ZoomFactor, Converter={StaticResource logConv}}" />The following example creates a Logarithmic Converter instance and configures its input minimum setting for a document workflow.
TXTextControl.WPF.LogarithmicConverter logarithmicConverter = new();
logarithmicConverter.InputMinimum = 1.0;Dim logarithmicConverter As New TXTextControl.WPF.LogarithmicConverter()
logarithmicConverter.InputMinimum = 1.0Members
Constructors
| Constructor | Description |
|---|---|
| LogarithmicConverter | Not described in the reference. public LogarithmicConverter(); |
Properties
| Property | Description |
|---|---|
| InputCenter | Sets or gets the numeric value of the source value range which will be mapped to the center of the target value range. |
| InputMaximum | Sets or gets the upper bound of the source value range. Larger input values coming from the binding source are handled as if they were equal to this value. |
| InputMinimum | Sets or gets the lower bound of the source value range. Smaller input values coming from the binding source are handled as if they were equal to this value. |
| OutputMaximum | Sets or gets the upper bound of the target value range. Larger values coming from the binding target are handled as if they were equal to this value. |
| OutputMinimum | Sets or gets the lower bound of the target value range. Smaller values coming from the binding target are handled as if they were equal to this value. |
Methods
| Method | Description |
|---|---|
| Convert | Converts an integer or a double precision floating point value to an integer or a double precision floating point value. |
| ConvertBack | Converts an integer or a double precision floating point value to an integer or a double precision floating point value. |