You need to add extra logic in your prog.
Your problem seems very similar to the Copy/Cut/Paste logic. You don't know if the paste command is valid because you don't know if the user press copy command before that.
Well, is up to you to register the states of this commands.
So you need to implement the logic suitable to your case, for example, if the list of items is empty, obviously you cannot edit it, etc.
About the interfaces (as others said), create them on the fly could be tricky and error prone. You can do it if only minor changes are to be made (hide/disable a few button/options)
If the interfaces are very different, better way to create a unique persistent widget for each, and put them in a StackedWidget.
Good luck :;)