如何在wpf中获取动态文本框的文本 [英] how to get text of dynamic text box in wpf

查看:424
本文介绍了如何在wpf中获取动态文本框的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public MainWindow()

{

InitializeComponent();

TextBox txt = new TextBox();

txt.Name =txt_search;

按钮btn =新按钮();

btn.Name =btn_search;

btn.Content =search;

btn.Click + = btn_search_click;





}

现在我想得到上面文字框的文字

onclickevent of button

public MainWindow()
{
InitializeComponent();
TextBox txt = new TextBox();
txt.Name = "txt_search";
Button btn = new Button();
btn.Name = "btn_search";
btn.Content = "search";
btn.Click += btn_search_click;


}
now i want get text of above creted text box
onclickevent of button

推荐答案

没有区别动态的和其他文本框,它们都同样动态。你需要的属性是相同的:

http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.text.aspx [ ^ ]。



-SA
There is no difference between "dynamic" and other text boxes, they all are equally "dynamic". And the property you need is the same:
http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.text.aspx[^].

—SA


这篇关于如何在wpf中获取动态文本框的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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