In WPF, you can use a Converter to convert between types such as a String and a Color. But a converter can be also used to convert between different units - for example twips and points.

Consider a combo box that should be bound to the InputFormat.FontSize that gets or sets the font's size, in twips, at the current input position. But typically, the font size is selected in points. In TX Text Control .NET for WPF, the MeasureConverter can be utilized which, provides a way to convert a measurement in twips (twentieth of a point) to a value in another unit. The XAML would look like this:

<Window.Resources>
    <tx:MeasureConverter Unit="Point" Decimals="1" x:Key="twipsconv" />
</Window.Resources>

<TextBox
   Height="21"
   Name="textBoxFontSize"
   Text="{Binding ElementName=textControl1,
      Path=InputFormat.FontSize,
      Converter={StaticResource twipsconv},
      Mode=TwoWay}"/>

Unfortunately, this concept is not provided when building .NET applications for Windows Forms. The data binding concept is quite similar, but events are required to convert between units. The following code shows how to add the Binding to the combo box:

Binding b = new Binding(
        "Text",
        textControl1.InputFormat,
        "FontSize",
        true,
        DataSourceUpdateMode.OnPropertyChanged);

b.Format += new ConvertEventHandler(b_Format);
b.Parse += new ConvertEventHandler(b_Parse);

comboBox1.DataBindings.Add(b);

Using the attached events, the units can be converted. A twip is a 1/20 of a point. Accordingly, we just need to multiply or divide the value by 20:

void b_Parse(object sender, ConvertEventArgs e)
{
    if (e.Value == null) return;

    e.Value = Convert.ToInt32(e.Value) * 20;
}
void b_Format(object sender, ConvertEventArgs e)
{
    if (e.Value == null) return;

    e.Value = ((int)e.Value / 20).ToString();
}