A follow up to this question, why is {x:Null}
no longer a valid option for Setter.Value
?
Put this code in a resource dictionary in your UWP app:
<Style x:Key="MyList"
TargetType="ListView">
<Setter Property="Transitions"
Value="{x:Null}"/>
</Style>
And use it in any ListView
:
<ListView Style="{StaticResource MyList}"/>
Your app will crash. A nasty crash as well, the kind that takes down the app without breaking properly in your debugger.
Also, the designer complains with a Catastrophic failure:
I know that setting values to {x:Null}
is valid. If you set the <ListView Transitions="{x:Null}"/>
directly, then it works fine... as expected.
So... what happened with style setters? ... Care to explain, Microsoft? Is there at least an alternate method?
It is really a weird behavior and overall because as you explained setting directly to null works and with the style does not. The only alternative I found is just set a clear transitioncollection:
I set the example of the DataContext that can be set to null, it says the same error but compiles and works.
I know it is not the best solution but it is a workaround to have a clear transitioncollection.
in this quiestion null-value-inside-a-template i've answered and you can find more answers