按钮的唯一ID? [英] Unique id for buttons?

查看:92
本文介绍了按钮的唯一ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在努力创建一个应用程序有一个自定义日历。所以我在Expression混合中拉了大约42个按钮。我想知道是否有任何方法可以将每个按钮引用为,将它们串行命名,以便我可以在
a for循环中使用它们。示例按钮(i,j),以便我可以访问for循环中的每个按钮。按钮有哪些种类索引?

I am tryin to make a application which has a custom calender. So i have pulled in around 42 buttons in Expression blend. I would like to know if there is any way by which I can refer each button as in, name them serially so that i can use them in a for loop. Example Button(i,j) so i can access every button in the for loop. Is there some kinds index for buttons?

 或者还有其他方法可以做到这一点吗?

 Or is there anyother way i can do this??

问题是我需要根据一些数据将一组图像放到按钮上。每个日期都有一个添加备注的选项。所以对于所有这些我需要有时单独访问这些按钮,在其他时候作为组。 。

The thing is i would need to put a set of images to the buttons based on some data. Every date will have an option to add notes. so for all these i would need to access these buttons sometimes individually and at other times as group. .

 

谢谢。 ,







 

推荐答案

这在预建表单中不存在,但它很容易添加自己。

This doesn't exist in a pre built form, but it would be easy to add yourself.

根据需要命名每个按钮,例如Button1,Button2,Button3,然后在你的代码隐藏文件中,在构造函数中你可以将它们放入数组或列表:

Name each of the buttons as appropriate, for example, Button1, Button2, Button3, then in your code behind file, in the constructor you can put them into an array or list:


public partial class MainPage : UserControl
	{
        List<Button> ButtonList = new List<Button>();
		public MainPage()
		{
			// Required to initialize variables
			InitializeComponent();
            this.ButtonList.Add(this.Button1);
            this.ButtonList.Add(this.Button2);
            this.ButtonList.Add(this.Button3);

		}
	}


这篇关于按钮的唯一ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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