How do you do a gradient fade to Aero glass in a WPF application like Office 2010 does?

Deadly 提交于 2019-12-09 06:30:36

问题


I am writing an application in WPF and I would like to have the top of the application fade from a color to Aero glass like the Office 2010 applications.

Really it will be fading the area just below the title bar from glass to a color. (I think that maybe a better way to describe it).


回答1:


I figured out how to get it to work. I set the entire window to have the aero glass effect on it using the native API's and then a create a LinearGradientBrush for my background of the window. In the brush I used the Alpha properties of the brush and set the stops to have the top of the window go from white/opaque to white/transparent all very close to the top of the window.

<Grid>
        <Grid.Background>
            <LinearGradientBrush StartPoint="1,0">
                <!-- This gradient stop is Fully transparent. -->
                <GradientStop Color="#00FFFFFF" Offset="0.0" />
                <!-- This gradient stop is fully opaque. -->
                <GradientStop Color="#FFFFFFFF" Offset="0.1" />
            </LinearGradientBrush>
        </Grid.Background>
</Grid>

I 1 up'd Mikko Rantanen's answer because I used the article to add the glass effect I didn't have the code handy and it was a good simple article.




回答2:


This reminds me of the way Windows Explorer/Internet Explorer continues Aero glass effect behind the address field. So I'd guess that if there is an API for this kind of effect, it will be a native Vista API which you need to call through P/Invoke similar to extending the glass effect. WPF doesn't really have any methods to control the Vista specific Aero theme I believe.



来源:https://stackoverflow.com/questions/894397/how-do-you-do-a-gradient-fade-to-aero-glass-in-a-wpf-application-like-office-201

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!