How can I cast to my UserControl type from ICommandItem

2738
1
Jump to solution
06-21-2015 07:40 PM
Highlighted
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.

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
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

Reply
0 Kudos
1 Reply
Highlighted
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

Reply
0 Kudos