Message 1 of 2
Not applicable
08-23-2018
10:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I intend to create an ExternalEvent when the user clicks on a button within a docked WPF form within revit. But, revit throws an error:
Autodesk.Revit.Exceptions.InvalidOperationException: 'Attempting to create an ExternalEvent outside of a standard API execution'
I have used the same method to start ExternalEvents from a modless windows form previously and it worked.
Here is the code:
public partial class Page1 : Page
{
public Page1()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
//NavigationService.Navigate(new Page2());
ExternalEventHandlerGetSelection ex = new ExternalEventHandlerGetSelection();
ExternalEvent exev = ExternalEvent.Create(ex);
exev.Raise();
}
}
Solved! Go to Solution.