开发者

How can I float buttons on top of controls when the mouse enters (WPF)?

开发者 https://www.devze.com 2023-01-28 05:28 出处:网络
I want to make a control which will work like the tab header in Visual Studio 2010. When you have a few tabs open (MainWindow.xaml, MainWindow.xaml.cs, etc.) only the active tab has a close button vi

I want to make a control which will work like the tab header in Visual Studio 2010.

When you have a few tabs open (MainWindow.xaml, MainWindow.xaml.cs, etc.) only the active tab has a close button visible, but when you hover the mouse ov开发者_运维问答er an inactive tab the close button appears, which means you can close any tab with one click.

It probably will be a border with text under the floated buttons.


All WPF controls are containers, you can put a button inside a button for example. You can have a layout manager to a control with the items you want in it.

For what you are asking about you could have a user control that has a TextArea and a Button in a StackPanel. Then hide the button. You then have the user control register for its MouseEnter and MouseLeave events and when the mouse is over you make the button visible, and when it leaves you hide it again.

0

精彩评论

暂无评论...
验证码 换一张
取 消