Hi,
I am fairly new to Ax 2012 and WPF so it may be simpler than I expect, but:
I am struggling to get data from Ax 2012 to present those in my custom WPF user control.
Mainly I want to use .NET DataGrid control to perform some more advanced presentation of data than the standard Ax control is capable of.
I was hoping to be able to run a query (using Query proxy) to the Ax and then somehow assign the results to DataTable which I could bind to DataContext property of the control.
I came up with this sample code in C# but I cannot seem to be able to cast Common object to CustTable
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
qbds = query.addDataSource(Global.tableName2Id("CustTable"));
qbr = qbds.addRange(Global.mo_fieldID("CustTable", "AccountNum")); // <- my custom method - wrapper around fieldnum(...)
qbr.value = txt_CustAcc.Text;
QueryRun queryRun = new QueryRun(query as object);
while (queryRun.next())
{
Common ct = queryRun.get(Global.tableName2Id("CustTable")); // this works perfectly fine
CustTable custTable = (CustTable)ct; // this throws an excpetion
......
Moreover with this technique I proobably will not be able to use DataTable to attach it to the grid as a datasource
Can someone advise how to access data from WPF in the best manner?
I wanted to use proxies - I am aware that in R2 it is possible to use Linq - will get my hands on it as soon as I download VPC image, but I was hoping to be able to use whatever I have already in place.
Thanks,
M