如何在 WPF 中从 XAML 调用调用方法? [英] How do I call a call method from XAML in WPF?

查看:29
本文介绍了如何在 WPF 中从 XAML 调用调用方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 WPF 中从 XAML 调用调用方法?

How do I call a call method from XAML in WPF?

推荐答案

处理这种情况的典型方法是将您的方法包装到 ICommand,并使用 WPF 中的命令基础结构.

The typical way this is handled is by wrapping your method into an ICommand, and using the Commanding infrastructure in WPF.

关于命令的博客,展示了这种方法的一些优点,尤其是当您使用 Josh Smith 的 MVVM 文章.

I blogged about Commanding, showing some of the advantages of this approach, especially when you use something like the RelayCommand implementation in Josh Smith's MVVM article.

这篇关于如何在 WPF 中从 XAML 调用调用方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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