我正在尝试解决性能问题。当前的 gremlin 是我的工具提示,它抛出:
System.Windows.Data Information: 41 : BindingExpression path error: 'ViewLine3' property not found for 'object' because data item is null. This could happen because the data provider has not produced any data yet. BindingExpression:Path=ViewLine3; DataItem=null; target element is 'TextBlock' (Name='line3ToolTip'); target property is 'Text' (type 'String')
System.Windows.Data Information: 20 : BindingExpression cannot retrieve value due to missing information. BindingExpression:Path=ViewLine3; DataItem=null; target element is 'TextBlock' (Name='line3ToolTip'); target property is 'Text' (type 'String')
System.Windows.Data Information: 21 : BindingExpression cannot retrieve value from null data item. This could happen when binding is detached or when binding to a Nullable type that has no value. BindingExpression:Path=ViewLine3; DataItem=null; target element is 'TextBlock' (Name='line3ToolTip'); target property is 'Text' (type 'String')
对于实现它的每个项目。我试图通过设置 FallbackValue、TargetNullValue、Delay、IsAsync 来使其静音,但问题仍然存在。
<StackPanel.ToolTip>
<ToolTip>
<StackPanel x:Name="suiteTooltip"
Width="auto">
<TextBlock x:Name="line3ToolTip"
Text="{Binding ViewLine3,
FallbackValue='NoData',
TargetNullValue='NoData',
Delay=500,
IsAsync=True}"/>
</StackPanel>
</ToolTip>
</StackPanel.ToolTip>
是否有另一个我不知道的后备方法可以让我处理工具提示生成的异常。
注意:信息仍在屏幕上正确显示。只有在创建时(当我更改模型以更改视图以创建具有此工具提示的元素时)才会出现这些错误。