Greg On Dynamics Ax

Random thoughts about development using Dynamics AX and .Net

Spell check text box – Example of a WPF control in AX

with 2 comments

This post shows how to add ‘Microsoft Word’ like spell checking to standard AX forms, taking the label editor as an example:

Spell check control in AX

Spell check control in AX

When a word is misspelled it will underline that word red, and right-clicking will show a context menu with alternative suggestions.

The user control and xpo are both available to download, with instructions to install at axaptapedia (see link at the bottom of this post).

How it was built

The first step is to create the user control in Visual Studio 2008.

All there is to the user control is a WPF Textbox – which has spell checking built in!
All you need to do is set the SpellCheck.IsEnabled property::

<TextBox Name="textBox" SpellCheck.IsEnabled="True" Language="en-gb"></TextBox>

This user control then needs to be exposed as an ActiveX to be used in Dynamics AX. (A very helpful colleague of mine gave me some guidance on this.)

Please see this link (MSDN Tutorial: Create a Win32 Application Hosting WPF Content) for an example on how to do this.

To automatically deploy to clients

In AX, make use of the SysFileDeployer framework. To do this subclass SysFileDeploymentDLL, ensuring that you override the filename method to return the name of your library.

Also if you have developed a .Net WPF control you will need to register the library using regasm instead of regsvr32, so make sure you override (or inherit) the register and unregister methods so that regasm is used:

class SysFileDeployment_DevWpf extends SysFileDeploymentDLL

public Filename filename()
 return 'WpfTextBoxControlLibActiveX.dll';

protected void register(boolean atReboot = false)
 //TODO Check regasm executable exists on client?
 WinAPI::shellExecute(#regasmCommand, strfmt('"%1" %2', this.destinationPath()+this.filename(),'/codebase'));

protected void unRegister()
 //TODO Check regasm executable exists on client?
 WinAPI::shellExecute(#regasmCommand, this.destinationPath()+this.filename()+' /unregister');

Then add your class(es) to the SysFileDeployer filesToDeploy method:

private static container filesToDeploy()
 return [classnum(SysFileDeployment_DevWpfMainControl), classnum(SysFileDeployment_DevWpf)];

Then ensure that your dll’s are shared on your server (copy them to your  %AXDIR%/50/Client/Share/Include directory on your AOS server) and either update the application version of AX, or delete the usage data for the SysFileDeployer job for each client, then each client that starts up will get the option to deploy your new libraries:


Download the control and example xpo here from axaptapedia
The steps for installing the control into your label editor can also be found here at axaptapedia


Written by gregondax

July 23, 2009 at 7:00 am

2 Responses

Subscribe to comments with RSS.

  1. Hi Greg,

    Do you have the Visual Studio project for this control?


    December 16, 2009 at 12:21 pm

  2. Hi
    I had to rewrite some methods in these Ax-classes, since the sourcepath() was called from client sometimes and server sometimes. Also the register/unregister methods (not used in your example) failed, since the full path of the file was not surrounded by ” “.



    January 8, 2010 at 12:09 pm

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: