New to Telerik UI for WPF? Download free 30-day trial

Badge is Missing When a Control has a Custom Control Template

Environment

Product Version 2022.3.1109
Product RadBadge for WPF

Description

RadBadge is not displayed when it is set on a control with custom control template.

Solution

The RadBadge control requires an AdornerLayer, in order to be displayed. When creating a custom ControlTemplate for a control, you could wrap the root element with an AdornerDecorator instance to apply an AdornerLayer onto its child elements in the visual tree.

Wrapping the root element of a ControlTemplate with an AdornerDecorator

<Window.Template> 
    <ControlTemplate TargetType="{x:Type Window}"> 
        <AdornerDecorator> 
            <Grid x:Name="rootElement"> 
                <!--ControlTemplate's structure--> 
            </Grid> 
        </AdornerDecorator> 
    </ControlTemplate> 
</Window.Template> 
In this article