Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用vs中的c#在WPF承载的页面上插入属性?_C#_Wpf_Xaml - Fatal编程技术网

如何使用vs中的c#在WPF承载的页面上插入属性?

如何使用vs中的c#在WPF承载的页面上插入属性?,c#,wpf,xaml,C#,Wpf,Xaml,我想在我用WPF/XAML托管的网站的username属性中插入一个字符串,但是当我尝试填充该属性时,我总是返回NULL System.ArgumentNullException:'值不能为null。(参数“ptr”)” 使用系统; 使用System.Windows; 命名空间WebBrowserControlIn_WPF { /// ///Window1.xaml的交互逻辑 /// 公共部分类Window1:Window { 公共窗口1() { 初始化组件(); } 已加载私有无效窗口

我想在我用WPF/XAML托管的网站的username属性中插入一个字符串,但是当我尝试填充该属性时,我总是返回
NULL

System.ArgumentNullException:'值不能为null。(参数“ptr”)”

使用系统;
使用System.Windows;
命名空间WebBrowserControlIn_WPF
{
///  
///Window1.xaml的交互逻辑
///  
公共部分类Window1:Window
{
公共窗口1()
{
初始化组件();
}
已加载私有无效窗口(对象发送器、路由目标)
{
myBrowser.Navigate(新Uri(“https://stiick.xyz/register"));
}
专用空白填充\u单击(对象发送者,路由目标e)
{
var document=myBrowser.document为mshtml.HTMLDocument;
var inputs=document.getElementsByTagName(“输入”);
foreach(输入中的mshtml.IHTMLElement元素)
{
}
动态单据=myBrowser.Document;
动态输入=doc.getElementsByTagName(“输入”);
foreach(输入中的动态元素)
{
if(element.getAttribute(“name”)=“username”)
{
element.setAttribute(“value”、“stringgoesher”);
打破
}
}
}
}