WPF .Net controls in Dynamics ax 2012

It is true that now we can use WPF or in general .net controls in dynamics ax 2012 forms. we can also craete new controls in .NET and add them to dynamics ax. It is one of those feature in Dynamics ax 2012 which bring fantastic new possibilities. Microsoft made a great effort to integrate the .NET environment and AX, not only from a run-time perspective but also for developers, easy event handling and so on.

 published the great blog on how you can build the .net controls and use them with Dynamics ax 2012. Please have a look at the blog get complete details . BLOG LINK

I am coverting the same topic but from different dimension. You can also you the .net Control in dynamics ax 2012 as Run time, ie you just need to write some simple code to render the .net control on you Dynamics ax form.

.Net Web Browser control programmatically to a Dynamics AX form

1. Create a form in dynamics ax 2012.

Open the form node from AOT and create a new form. Chnage the name and name it properly.

2. Add the web browser control programmatically and will try Use the Navigate method of the web  browser control to browse to http://www.microsoft.com.

public void init()
{
    FormManagedHostControl          managedHostControl;
    System.Windows.Forms.WebBrowser myBrowser;

    super();
    // add in our ManagedHost control and name it ManagedBrowser
    managedHostControl = this.design().addControl(FormControlType::ManagedHost,"ManagedBrowser");
    // add in the needed assembly information into the ManagedHost control properties
    managedHostControl.assemblyName("System.Windows.Forms, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089");
    managedHostControl.typeName("System.Windows.Forms.WebBrowser");
    managedHostControl.sizing(Sizing::SizeToContent);
    // get the context of the browser so we can use its methods
    myBrowser = managedHostControl.control();
    // navigate to our destination
    myBrowser.Navigate("http://www.microsoft.com");
}

Open the form either by hitting F5 in the X++ editor, or right clicking in the AOT
and choosing open.

How can i deploy my own control to be available in AX.

When the control is finished, build the project, right-click it and choose Open Folder in Windows Explorer. Go to \bin\Debug folder and copy YourControl.dll to the Bin directory of AX client (e.g. c:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin).

With i blog i got an idea of using the WPF control in EP Dynamics ax 2012 as webpart. i will check if it is possible and how ? if anyone of you knows please publish here .


About these ads

One Response to WPF .Net controls in Dynamics ax 2012

  1. Amir Nazim says:

    Method Init is suppose to write in the Init method of form.. That explanation is missing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 120 other followers

%d bloggers like this: