从XAML页面将文本框值转换为文件背后的代码 [英] Get textbox value into code behind file from xaml page

查看:62
本文介绍了从XAML页面将文本框值转换为文件背后的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在radgridview中有一个文本框.我想将该文本框值添加到我的代码隐藏文件中,以将其传递到视图模型中.在这里,我没有获得"findcontrol"属性,因此任何人都请帮助我如何获取文本框值.

Hi i have a textbox in radgridview. And i want to get that textbox value into my codebehind file to pass it into view model. Here i didnt get "findcontrol" property so any one please help me how to get the textbox value.

推荐答案

在WPF中使用FindControl毫无意义(以及System.Windows.Forms中的内容).您可以将属性name添加到XAML TextBox元素,并为其赋予有效的C#标识符值.它将在您的窗口或页面类中生成C#成员声明.用它.在您的情况下,请使用myTextBox.Text.

—SA
Using FindControl would not make any sense in WPF (as well as in System.Windows.Forms, by the way). You can add the attribute name to the XAML TextBox element and give it a value of valid C# identifier. It will generate C# member declaration in your window or page class. Use it. In your case, use myTextBox.Text.

—SA


这篇关于从XAML页面将文本框值转换为文件背后的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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