I've got a user control with a control template to show validation errors, validation template:

&lt;ControlTemplate x:Key="TextBoxPropertyValidationTemplate"&gt;
        &lt;StackPanel&gt;
            &lt;Border BorderBrush="Red" BorderThickness="1"&gt;
                &lt;AdornedElementPlaceholder x:Name="MyAdorner" /&gt;
            &lt;/Border&gt;

            &lt;Grid&gt;
                &lt;Grid.ColumnDefinitions&gt;
                    &lt;ColumnDefinition Width="Auto" /&gt;
                    &lt;ColumnDefinition Width="*" /&gt;
                &lt;/Grid.ColumnDefinitions&gt;
                &lt;Image Grid.Column="0" MaxHeight="16" MaxWidth="16"
                       Source="{Binding Source={StaticResource ValidationIcon}, Converter={StaticResource UriConverter}}" 
                       Margin="1" RenderOptions.BitmapScalingMode="HighQuality"
                       VerticalAlignment="Center" HorizontalAlignment="Center" /&gt;
                &lt;TextBlock VerticalAlignment="Center" HorizontalAlignment="Left"
                           Text="{Binding ElementName=MyAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"
                           TextWrapping="Wrap" Grid.Column="1" FontSize="10" Foreground="Red" /&gt;
            &lt;/Grid&gt;

        &lt;/StackPanel&gt;
    &lt;/ControlTemplate&gt;


And I can't seem to get around a rather irritating problem which looks like this:



I've been trying to play around with margins on the user control and on the template also some Height=Auto etc but all these don't really help. Any ideas anyone?

If that helps the main user control (which nests the ones with validation) is in a TabItem with a AdornerDecorator.

Any help appreciated.


Question: Dealing with digital circuits and their associated switching speed?
Answer: The way I see it, you're causing problems for yourself by using multiple clock domains, and worse, deriving a clock from data. The problem with data is that it has to settle. That's why we have separate clocks. A combinatorial circuit which evaluates some variables and then drives a clock invites trouble.

Secondly, if you're going to kludge it, at least do it right. You cannot detect a 9 by noting that the first and last of four bits bit are 1. If you want a signal which fires when there is a 9, you must evaluate all four bits earnestly and trigger that signal only when they are 1001.

There is no reason not to design this in such a way that a single clock is distributed to all the chips. Then it's a matter of running the clock slowly enough that all inputs and outputs settle before each edge arrives.

Read the data sheet. The TI one clearly says "The carry look-ahead circuitry provides for n-bit synchronous applications without additional gating. Instrumental in accomplishing this function are two count-enable inputs and a ripple carry output. Both count enable inputs P and T must be high to count [...]".

It sounds like these chips are intended to be hooked up together easily. You can prevent the upper digit from counting up on the next clock edge by de-asserting its count enable inputs. Whenever the lower digit is nine, your circuitry can enable the upper digit chip to count, and also set up the lower digit to perform a synchronous reset. 

When the next clock edge arrives (to all chips), the upper digit counts up, and the other flips to zero.