简体   繁体   English

始终在顶部创建按钮

[英]Create button always on top

I'm trying to make a Button always stay on top even after minimize the application. 即使在最小化应用程序之后,我也试图使Button始终保持最佳状态。 Quite like a floating Button , when I click the Button the application hide, click it again the application show. 就像一个浮动Button ,当我单击应用程序隐藏的按钮时,再次单击应用程序显示。

Window can set the Topmost="True" property, what about the Button ? Window可以设置Topmost="True"属性, Button怎么样?

You should make more one window with button, like this in XAML: 您应该使用按钮创建一个窗口,如XAML中所示:

<Window AllowTransparency="True" ResizeMode="NoResize" WindowStyle="None"
        Topmost="True" ShowInTaskbar="False" SizeToContent="WidthAndHeight"
        Background="{x:Null}">
    <Button x:Name="HideShowButton" Content="Restore" />
</Window>

Button cannot exist without window, but with these properies window will be invisible. 没有窗口的按钮不能存在,但是这些特性窗口将是不可见的。

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

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