这不是什么WPF问题,这就是后台逻辑如何写的问题。
[quote=引用 7 楼 duanzi_peng 的回复:] [quote=引用 4 楼 zwycaogen 的回复:] [quote=引用 3 楼 duanzi_peng 的回复:] [quote=引用 2 楼 zwycaogen 的回复:] [quote=引用 1 楼 duanzi_peng 的回复:] 后台for 循环 遍历添加呀,类似: for(int i=0;i<3;i++){ TextBox tb = new TextBox(); tb.Name="Name"+i; tb.KeyUp +=事件名称 // 添加到父容器 xx.Children.Add(tb); }
[quote=引用 4 楼 zwycaogen 的回复:] [quote=引用 3 楼 duanzi_peng 的回复:] [quote=引用 2 楼 zwycaogen 的回复:] [quote=引用 1 楼 duanzi_peng 的回复:] 后台for 循环 遍历添加呀,类似: for(int i=0;i<3;i++){ TextBox tb = new TextBox(); tb.Name="Name"+i; tb.KeyUp +=事件名称 // 添加到父容器 xx.Children.Add(tb); }
你可以把你的逻辑写成一个函数,而将textbox作为函数的参数传进来,需要哪个textbox就传哪个。
你逻辑代码是什么样的,事件怎么调用textbox的??
[quote=引用 3 楼 duanzi_peng 的回复:] [quote=引用 2 楼 zwycaogen 的回复:] [quote=引用 1 楼 duanzi_peng 的回复:] 后台for 循环 遍历添加呀,类似: for(int i=0;i<3;i++){ TextBox tb = new TextBox(); tb.Name="Name"+i; tb.KeyUp +=事件名称 // 添加到父容器 xx.Children.Add(tb); }
[quote=引用 2 楼 zwycaogen 的回复:] [quote=引用 1 楼 duanzi_peng 的回复:] 后台for 循环 遍历添加呀,类似: for(int i=0;i<3;i++){ TextBox tb = new TextBox(); tb.Name="Name"+i; tb.KeyUp +=事件名称 // 添加到父容器 xx.Children.Add(tb); }
[quote=引用 1 楼 duanzi_peng 的回复:] 后台for 循环 遍历添加呀,类似: for(int i=0;i<3;i++){ TextBox tb = new TextBox(); tb.Name="Name"+i; tb.KeyUp +=事件名称 // 添加到父容器 xx.Children.Add(tb); }
后台for 循环 遍历添加呀,类似: for(int i=0;i<3;i++){ TextBox tb = new TextBox(); tb.Name="Name"+i; tb.KeyUp +=事件名称 // 添加到父容器 xx.Children.Add(tb); }
110,545
社区成员
642,581
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧