开发者

WPF: Trigger on DependencyProperty.UnsetValue

开发者 https://www.devze.com 2022-12-25 20:22 出处:网络
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 does

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

精彩评论

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