创建在WPF自定义关闭 [英] Creating a custom Close Button in WPF

查看:131
本文介绍了创建在WPF自定义关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是相当新的WPF / C#和我想实现自定义窗口装饰的。我需要创建一个关闭按钮,基本上的行为完全为接近或<大骨节病> X 按钮,亮起的Windows应用程序的每个窗口的Chrome。

I am rather new to WPF/C# and I am thinking of implementing a custom window decorator. I need to create a Close button which basically behaves exactly as the close or x button which comes on every window's chrome of Windows applications.

推荐答案

只要从按钮来调用的close()功能:

Simply call the close() function from your button:

WPF:

<Button Name="CloseButton" Content="x" Click="CloseButton_Click" />

code-背后:

code-behind:

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
    Close();
}

这篇关于创建在WPF自定义关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆