本文介绍了WPF C#简单绑定问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在WPF中,
我想做一个简单的命令。
运行tableadapter查询以返回一些结果,
我希望将每个结果插入到Collection中。
我知道代码错了,但我想展示我想要完成的目标。
看看DATASET?
您可能会告诉我从Windows窗体移过来并且没有使用xaml。任何代码都会有所帮助。
谢谢,
In WPF,
I want to do a simple command.
Run a tableadapter query to return some results,
I want each of those results to be inserted into a Collection.
I know the code is wrong but I want to show the goal I want to accomplish.
Look at DATASET?
You can probably tell I moved over from windows forms and am not experienced with xaml. Any code will help.
Thank you,
public class FieldCollection : ObservableCollection<FieldName>
{
public FieldCollection(int test)
: base()
{
DataTableAdapters.DataTableAdapter NewAdapter = new DataTableAdapters.DataTableAdapter();
DATASET? = DataTableAdapter.GetData(test);
foreach (datarow row in DATASET?)
{
Add(new FieldName("test"));
}
}
}
public class FieldName
{
private string fieldvalue;
public FieldName(string field)
{
this.fieldvalue = field;
}
public string FieldValue
{
get { return fieldvalue; }
set { fieldvalue = value; }
}
}
编辑:添加代码块。
added code block.
推荐答案
这篇关于WPF C#简单绑定问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!