How can I cast to my UserControl type from ICommandItem

3114
1
Jump to solution
06-21-2015 07:40 PM
MarkMindlin
Occasional Contributor III

Hi there,

I am trying to get my UserControl be found like this:

ICommandItem pItem = pApplication.Document.CommandBars.Find(pUID, false, false);

MyUserControlType pMyTool = pItem.(Command as MyUserControlType);

But I cannot see the row with word "Command" (when drop down menu appears - see the image attached).

What I do wrong?

I am in 10.3 Desktop ArcObjects C#.

Any help will be appreciated.

0 Kudos
1 Solution

Accepted Solutions
AhmedEl-Sisi
Occasional Contributor III

I can't find command property too but when I typed the property it works fine.

ICommand pCommand = pItem.Command as ICommand;

Then you can cast it to your type.

View solution in original post

0 Kudos
1 Reply
AhmedEl-Sisi
Occasional Contributor III

I can't find command property too but when I typed the property it works fine.

ICommand pCommand = pItem.Command as ICommand;

Then you can cast it to your type.

0 Kudos