1
Vote

DropShadowEffect properties should be double

description

I tried your code but as soon as I change the value of the properties Radius, ShadowDepth and Direction to literal values instead of bindings I get exceptions.
<xamlfx:ShaderContentControl.Effect>
   <xamlfx:DropShadowEffect Radius="5" ShadowDepth="0" Direction="0" />
</xamlfx:ShaderContentControl.Effect>
WinRT information: Failed to create a 'Single' from the text '5'. [Line: 59 Position: 41]
Additional information: The text associated with this error code could not be found.
It turned out that changing the properties type from float to double fixes the problem.
DEPENDENCY_PROPERTY(Radius,      double)
DEPENDENCY_PROPERTY(ShadowDepth, double)
DEPENDENCY_PROPERTY(Direction,   double)

DEPENDENCY_PROPERTY_IMP_ONCHANGE(DropShadowEffect, Radius,      double, 5.0,   OnBlurChanged)
DEPENDENCY_PROPERTY_IMP_ONCHANGE(DropShadowEffect, ShadowDepth, double, 5.0, OnShadowDepthChanged)
DEPENDENCY_PROPERTY_IMP_ONCHANGE(DropShadowEffect, Direction,   double, 315.0, OnDirectionChanged)
There are some additional casts you have to do in SetPadding and OnBlurChanged.

This seem to work well with both literal values and bindings.

comments