本文介绍了WPF 控件的公共类修饰符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建 Windows 应用程序和类库.类库包含名为InsertForm.xaml"的 WPF 控件
I'm creating Windows application and Class library. Class library contains WPF control named "InsertForm.xaml"
InsertForm 包含名为 eUserName 的 TextBox.
InsertForm contains TextBox named eUserName.
我正在使用以下代码来显示 InsertForm.那是成功的.但我无法访问 eUserName.如何将文本框修饰符设置为公开?
I'm using the following code to show InsertForm. That's successful. But I can't access eUserName. How to set Textbox modifiers to public?
使用 System.Windows.Forms.Integration
ElementHost host = new ElementHost();
iform= new Extender.InsertForm();
host.Child = iform;
this.Controls.Add(host);
推荐答案
这行得通吗?
<TextBox Name="eUserName" x:FieldModifier="public"/>
这篇关于WPF 控件的公共类修饰符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!