Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf 有没有一种方法可以使自定义着色器效果属性在混合中设置动画?_Wpf_Animation_Shader_Expression Blend - Fatal编程技术网

Wpf 有没有一种方法可以使自定义着色器效果属性在混合中设置动画?

Wpf 有没有一种方法可以使自定义着色器效果属性在混合中设置动画?,wpf,animation,shader,expression-blend,Wpf,Animation,Shader,Expression Blend,在混合UI上无法看到自定义着色器属性,如下图所示: 通过查看DropShadowEffect的来源(它是WPF的一部分),可设置动画的属性定义如下: DropShadowEffect.ShadowDepthProperty = Animatable.RegisterProperty(...); var pixelShader = new PixelShader(); pixelShader.UriSource = new Uri(@"pack://application:,,,/YourAs

在混合UI上无法看到自定义着色器属性,如下图所示:

通过查看DropShadowEffect的来源(它是WPF的一部分),可设置动画的属性定义如下:

DropShadowEffect.ShadowDepthProperty = Animatable.RegisterProperty(...);
var pixelShader = new PixelShader();
pixelShader.UriSource = new Uri(@"pack://application:,,,/YourAssembly;component/YourEffect.ps", UriKind.Absolute);
不幸的是,可设置动画的.RegisterProperty方法是内部的禁止这样做的是,唯一有效的方法是手动编写情节提要


有没有一种方法或库可以让自定义着色器恢复此功能?

找到问题的根源:着色器的URI不完整

应该是这样的:

DropShadowEffect.ShadowDepthProperty = Animatable.RegisterProperty(...);
var pixelShader = new PixelShader();
pixelShader.UriSource = new Uri(@"pack://application:,,,/YourAssembly;component/YourEffect.ps", UriKind.Absolute);
微妙之处:不要忘记@

参考:

属性现在已恢复:)

注意:之前所有关于这个问题的东西(动画)都不再需要了