.NET FRAMEWORK4 WPFAdornerLayer.GetAdornerLayer 为空的解决办法

var adornerLayer = AdornerLayer.GetAdornerLayer(element); 找不到装饰器adornerLayer 

手动添加装饰器

 <AdornerDecorator Margin="0">
                                <TextBox Width="200" Height="30" Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"></TextBox>
                            </AdornerDecorator>
原文地址:https://www.cnblogs.com/tangchun/p/12856634.html