Saturday, February 14, 2015

How to assign a help document to a tool item with LinsUIWPF Suite

Prerequisite: Follow the link How to create a new project to create your application with LinsUIWPF Suite.

Then, there are four ways to assign a help document to a tool item.                                 
First way,
1.     Open App.xaml.cs file set the “DefaultHelpFilePath” as follows,
public partial class App : Application
public App()
Assembly assem = Assembly.GetEntryAssembly();
string csAssemName = assem.Location;
string csProjectName = assem.GetName().Name;
string csAppDirectory = Path.GetDirectoryName(csAssemName);
int nIndex = csAppDirectory.LastIndexOf('\\');
string csHelpFilesDirectory = csAppDirectory.Remove(nIndex);

FlexUISettings.DefaultHelpFilePath = System.IO.Path.Combine(csHelpFilesDirectory, "HelpFiles");

2.     Create a RTF format file or Text format file, for example, MyHelpFile.rtf. Store it under “…\YourApplicationProject\HelpFiles\”
3.     Assign MyHelpFile to a tool item as follows,
myToolItem.HelpFile = "MyHelpFile.rtf"

Second way,
1.     Assign the detail help content to the tool item as follows,
myToolItem.HelpContext = “ Here is your description”

Third way,
1.     Assign a unique ID, which is between FlexConstants.m_nUserDefinedControlStartID (1000) and FlexConstants.m_nUserDefinedControlStartID (10,000,000), to the CommandID attribute of the tool item.
<src:FlexMenuItem ID="1022" CommandID="1001" Text=”My Command” Name=”myToolItem”/>
2.     Create a class as follow, and implement the “COMMAND_EVENT.HELPBUTTON_CLICK”
class MyCommand : LinsUICommand
public MyCommand(long nCommandID, object data) base(nCommandID, data)

public override void Execute(object parameter)

protected void HelpClick(object sender, EventArgs e)
// Create and show your own help document here when the ? help button is clicked

public override bool CanExecute(object parameter)
return true;
3.     Create the command with the given unique ID (here is 1001). It will automatically link the command to the tool item.
public partial class Window1 : LinsMDIWindow
public Window1()

MyCommand myCommand = new MyCommand(1001, null);

Fourth way,
1.     Customize it as the Video shown; Assign a Help Document to a Tool Item

Command Events,
Commands Manager,
How To,

No comments:

Post a Comment