使用xml在WPF中创建动态UI [英] Using xml to make dynamic UI in wpf

查看:267
本文介绍了使用xml在WPF中创建动态UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的UI由两部分组成:一个已经在UI上的BIG按钮和三个需要动态创建的SMALL按钮.首先,我单击一个SMALL按钮,然后单击BIG按钮,然后将出现一个消息框,向我显示我单击了哪个小按钮.
1.如何获取SMALL(小)按钮的信号并将其传输到BIG(大)按钮?

2.如果我动态创建所有按钮,那么如何编写每个按钮的响应功能?

圣诞快乐!

My UI is combined with 2 parts: one BIG buttons that already on the UI and three SMALL buttons which need to be created dynamically. First I click one of the SMALL buttons, then I click the BIG button, then there will be a messagebox shows me which small button I clicked.
1.How can I get the signal of the SMALL button and transmit it to the BIG button?

2.If I create all the buttons dynamically then how to write the response function of each button?

Merry Christmas!

推荐答案

您将需要使用可视化树并获取按钮的实例.
然后可以将事件处理程序添加到按钮.

请参见此处 [
You would need to use the visual tree and get an instance of the button.
You can then add an event handler to the button.

See here[^].


这篇关于使用xml在WPF中创建动态UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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