.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>

 

posted @ 2020-05-09 13:02  _York  阅读(381)  评论(0编辑  收藏  举报