开发者

WPF: Trigger on DependencyProperty.UnsetValue

in an answer to this question the following statement was made

"In theory it might be possible to .... trigger on {x:Static DependencyProperty.UnsetValue}, which would be much cleaner, but this doesn't appear to work in pract开发者_运维知识库ice."

Has anybody had any luck in doing this?


A failing Binding will return null (or the fallbackvalue), which is different from an UnsetValue.

the answer itowlson gave you is probably the best you will get. In this specific case, you might be able to use:

<DataTrigger Binding="{Binding Hibble, FallbackValue={x:Static DependencyProperty.UnsetValue}}" Value="{x:Static DependencyProperty.UnsetValue}">
  <Setter Property="Background" Value="Red" />
</DataTrigger>

which is practically the same.

(you might want to take a look into this)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜