简体   繁体   English

WPF浏览器控件出现不透明动画问题

[英]WPF Browser Control gives an opacity animation issue

Why I cannot animate the opacity of the WPF Browser Control? 为什么我不能为WPF浏览器控件的不透明度设置动画? I also tried to chanage the opacity of the upper object which is Canvas, but no success. 我还尝试过更改上部对象Canvas的不透明度,但是没有成功。

Is there some way to do it? 有什么办法吗? Thank you! 谢谢!

var doubleAnimation = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(0.45)));
RootGrid.BeginAnimation(UIElement.OpacityProperty, doubleAnimation);
MainBrowser.BeginAnimation(UIElement.OpacityProperty, doubleAnimation);

 <Grid Background="Transparent"  Name="RootGrid"  >       
        <WebBrowser x:Name="MainBrowser"   />
    </Grid>

The short answer is no that is not supported. 简短的答案是不,这是不受支持的。 This page explains the limitations when dealing with Interop content. 本页说明处理Interop内容时的限制。 But the section that applies is: 但是适用的部分是:

Opacity/Layered Windows/AllowTransparency 不透明度/分层Windows /允许透明

Setting Opacity on a WindowsFormsHost (setting AllowsTransparency on a Window) will not work, since HwndHost doesn't support this. 由于HwndHost不支持在WindowsFormsHost上设置不透明度(在Window上设置AllowsTransparency),因此不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM