<UserControl x:Class="Elwig.Controls.UnitTextBox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="25"> <TextBox x:Name="TextBox" TextAlignment="Right" FontSize="14" VerticalAlignment="Stretch" Padding="{Binding ElementName=UnitBlock, Path=ActualWidth, Converter={StaticResource WidthToPaddingConverter}}" Text="{Binding Path=Text}" TextChanged="TextBox_TextChanged"/> <TextBlock x:Name="UnitBlock" Text="{Binding Path=Unit}" Margin="0,0,4,4" FontSize="10" HorizontalAlignment="Right" VerticalAlignment="Bottom"/> </Grid> </UserControl>