触发器上的属性不能为空

Abs*_*tor 3 wpf xaml dependency-properties

<Style TargetType="controls:EventTimeView">      
    <Style.Triggers>         
        <Trigger Property="PositioningMethod" Value="Column" >
            <Setter Property="Background" Value="Black" />
        </Trigger>
    </Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)

PositioningMethod是枚举类型的EventTimeView的依赖项属性.

结果是:

System.InvalidOperationException occurred
Message=Property can not be null on Trigger.
Source=PresentationFramework
StackTrace:
   at System.Windows.StyleHelper.UpdateTables(PropertyValue& propertyValue, FrugalStructList`1& childRecordFromChildIndex, FrugalStructList`1& triggerSourceRecordFromChildIndex, FrugalStructList`1& resourceDependents, HybridDictionary& dataTriggerRecordFromBinding, HybridDictionary childIndexFromChildName, Boolean& hasInstanceValues)
InnerException: 
Run Code Online (Sandbox Code Playgroud)

我不知道可能出错了什么.例外太模糊了:哪个属性?什么是null?

Dan*_*ore 13

仔细检查PositioningMethodProperty的DependencyProperty定义 - 确保拥有类型实际上是定义DP的类.