Open DouglasLSilva opened 4 years ago
I solved the problem by creating an empty constructor in MainWindow.
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
public MainWindow(IUnityContainer container)
{
DataContext = container.Resolve<IMainWindowViewModel>();
InitializeComponent();
}
}
But i wanna know if is possible to use Tabs on a User Control ? Because in the first time a was using the tabs on a UserControl
I think you should implement InterTabClient. In this way you can control creation of MainWindow instance.
Here's mine:
public class InterTabClient : IInterTabClient
{
public INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
{
var view = ServiceLocator.Current.GetInstance<MainWindow>();
return new NewTabHost<Window>(view, view.Tabs);
}
public TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window)
{
return TabEmptiedResponse.CloseWindowOrLayoutBranch;
}
}
In MainWindow:
<dragablz:TabablzControl.InterTabController>
<dragablz:InterTabController InterTabClient="{Binding InterTabClient}" />
</dragablz:TabablzControl.InterTabController>
In MainViewWindowModel:
public IInterTabClient InterTabClient { get; } = new InterTabClient();
I Create a new WPF Application with Unity IOC and when a drag the tabs out, occurs a exception.
Here's the StackTrace
And this is the XAML:
I don`t know what to do to correct this error, pls help ")