I have UI app extensions in separate dll files I am connecting to through MEF. My question is, if they have a dialog (WPF user control), should I make the dialog a property of the extension like so:
public UserControl ExtDialog { get; set; }
or should I load them in a pack uri?
public string ExtDialogUri { get; set; }
I am leaning to the pack uri, but unsure whether it would actually work. Which way is the more "recommended" way of doing it?
NOTE: These dialogs will be navigated to with the NavigationService.Navigate(); method.
I would use neither of the options. The thing is that both methods lack flexibility in regards of time when the dialog is created. If the first method is used, then the dialog will be created always, no matter whether it is needed or not. With the pack url the problem is that the extensions will not have control over how instances of the dialog are created. What if the control needs to be initialized after creation (view model needs to be created, etc.)?
In my opinion, it is better to expose a factory that will be used to create the dialog:
public IExtDialogFactory ExtDialogFactory { get; set; }
public interface IExtDialogFactory
{
UserControl CreateDialog();
}