Search code examples
wpfanimationshaderexpression-blend

Is there a way to make custom shader effect properties animatable inside Blend?


Custom shader properties cannot be seen on the Blend UI such as in picture below :

enter image description here

By looking at source of DropShadowEffect (which is part of WPF), animatable properties have been defined like this :

DropShadowEffect.ShadowDepthProperty = Animatable.RegisterProperty(...);

Unfortunately, Animatable.RegisterProperty method is internal what forbids doing so, the only way working is to manually code a storyboard.

Is there a way or a library that would allow to have this ability back for custom shaders ?


Solution

  • Found the origin of the issue : the URI of the shader was incomplete !

    It should be like this :

    var pixelShader = new PixelShader();
    pixelShader.UriSource = new Uri(@"pack://application:,,,/YourAssembly;component/YourEffect.ps", UriKind.Absolute);
    

    Subtlety : do not forget the @

    Reference :

    https://stackoverflow.com/a/13112241/361899

    Properties are back now :)

    enter image description here

    Note : all previous stuff on question (Animatable) is not needed anymore.