我得到以下内容:



当ListView属性在可视状态下设置为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/

10-09 06:13
查看更多