The Process of Embedding InRule Controls

  • Updated

Assemblies required

The minimal assemblies required for embedding InRule controls for WPF (unless otherwise noted) include the following: 

Assembly Name








WPF assemblies are located in <InRule installation directory>\irSDK\bin.

Control Factory

The Control Factory is a class in The Rule Authoring Framework that abstracts much of the code required to create an instance of a control that can edit an InRule definition object (Entity, Rule Set, Rule, etc).  The job of the Control Factory is to provide a control based on the type of object which is passed in.


The typical process for embedding one of InRule's controls in WPF is as follows:

  1. Create an instance of the ControlFactory
  2. Load the Rule Application
  3. Load the Rule Application into the Control Factory
  4. Get the desired rule to be edited
  5. Call the GetControl method on the Control Factory passing the definition object to be edited.
  6. Load the control into the form.  A common approach is to use the ContentControl available in WPF.

Sample code:

// Create control factory
var _controlFactory = new ControlFactory();
// Load the rule app
var _ruleAppDef = RuleApplicationDef.Load(@"C:\work\MortgageCalculator.ruleapp");
// Load the rule app into the control factory
RuleSetDef langRule = _ruleAppDef.GetRuleSet("ValidateLoanInfo");
// Get the control and load it into the content control in the form
contentControl.Content = _controlFactory.GetControl(langRule);

Please see Embedding InRule Default Editors for more details.


Any changes that are made in an embedded control must be saved back to the rule application.  Some changes are saved automatically back to the rule application. However, it is best to call the SaveValues method as shown below to ensure everything is saved correctly.  Here is the code required to perform the save.

Note: This saves changes the RuleApplicationDef that is in memory, saving back to the file system or Catalog is a separate operation.

public void SaveRule(IValidatingEditor editor)
 if (editor != null)

Controls with Display Options

Using the ControlFactory's GetControl method as described above will return the entire control as it is seen in irAuthor.  This includes a label and image based on the type of control, a text box for updating the object's Name and a check box for enabling/disabling rules (if applicable).  There are cases where it may not be desirable to have the entire editor displayed in an application.  For this reason, the most commonly used controls can also be embedded without these extra items.  The controls available in this manner are the Business Language, Decision Table and Condition editors.  See Embedding the Language Rule EditorEmbedding the Decision Table Editor and Embedding the Condition Editor for samples of each.

Was this article helpful?

0 out of 0 found this helpful



Please sign in to leave a comment.