我得到以下信息:
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
当 ListView 属性在 Visual State 中设置为 Null 时。没道理,VS和Blend为什么会提示?
<VisualState.Setters>
<Setter Target="listView.(Selector.IsSynchronizedWithCurrentItem)" Value="{x:Null}"/>
</VisualState.Setters>
编辑
一个类似的问题:
<VisualState.Setters>
<Setter Target="NumberButtonBox.(RelativePanel.RightOf)" Value="{x:Null}" />
<Setter Target="NumberButtonBox.(RelativePanel.Below)" Value="GridPlaceholder" />
</VisualState.Setters>
其中 NumberButtonBox 定义为
<Viewbox x:Name="NumberButtonBox" RelativePanel.RightOf="GridPlaceholder" MaxWidth="250" MaxHeight="450" MinWidth="200">
该错误仅在使用值
{x:Null}
的 setter 上显示,不在另一条线上。更改 Setter 行的顺序无效。以这种方式将属性设置为 Null 是清除此值的正确方法吗?在运行时它确实有效,只是编辑器对此有问题。
最佳答案
在设计时设置 null 而不会崩溃的唯一替代方法是这个(如 this similar question 中所述)
例子:
<Style x:Key="MyList" TargetType="ListView">
<Setter Property="Transitions" >
<Setter.Value>
<TransitionCollection></TransitionCollection>
</Setter.Value>
</Setter>
</Style>
代替:
Style x:Key="MyList"
TargetType="ListView">
<Setter Property="Transitions"
Value="{x:Null}"/>
</Style>
关于crash - E_UNEXPECTED UWP 灾难性故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34292889/