小编Sar*_*ina的帖子

WPF:Automation.Peers.ItemAutomationPeer.GetNameCore 处的 NullReferenceException

我有一个棘手的问题,为此花了一整天的时间,但仍然无法解决。我在 WPF UI 上有一个按钮,用于向树视图添加项目,xaml 中的代码如下:

<Button Content="Create Item"  
                                        Command="{Binding NewItem}"
                                        Click="NewItemButton_Click"
                                        TabIndex="16"                                                                                           
                                        ToolTip="{Binding NewItemHelpText}"
                                        ToolTipService.ShowOnDisabled="True">
                                        <Button.IsEnabled>
                                            <MultiBinding Converter="{StaticResource LogicalAndConverter}">
                                                <Binding Path="CurrentItem" Converter="{StaticResource ItemCreationConverter}"/>
                                                <Binding Path="ControlMode" Converter="{StaticResource MyConverter}" ConverterParameter="{x:Static local:Option.ReadOnly}"/>
                                            </MultiBinding>
                                        </Button.IsEnabled>
                                    </Button>
Run Code Online (Sandbox Code Playgroud)

有时候,点击这个按钮后,会抛出异常,

> ERROR MyApplication.App [(null)] - Error in MyApplication
   System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Windows.Automation.Peers.ItemAutomationPeer.GetNameCore()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdatePeer(Object arg)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate …
Run Code Online (Sandbox Code Playgroud)

wpf automation nullreferenceexception

5
推荐指数
1
解决办法
207
查看次数

Vue:请求进行中时显示加载程序

我要实施以下流程:

当http请求正在进行时,显示加载程序。请求完成后,隐藏加载程序。

javascript vue.js vue-router vuex

3
推荐指数
1
解决办法
6589
查看次数