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>

 

相关文章: