Lance
Lance

Reputation: 611

Dragablz components and using a different window as the host

I'm trying to implement a secondary window as the window host for Dragablz tearable tab controls using the IInterTabClient as such: Public Class TRInterTabClient Implements Dragablz.IInterTabClient

Public Function GetNewHost(interTabClient As Dragablz.IInterTabClient, partition As Object, source As Dragablz.TabablzControl) As Dragablz.INewTabHost(Of Window) Implements Dragablz.IInterTabClient.GetNewHost
    Dim host As New TabHost
    Return New Dragablz.NewTabHost(Of TabHost)(host, host.tabContainer)
End Function

Public Function TabEmptiedHandler(tabControl As Dragablz.TabablzControl, window As Window) As Dragablz.TabEmptiedResponse Implements Dragablz.IInterTabClient.TabEmptiedHandler
End Function

End Class I am not using the MVVM pattern and so I thought that creating a DependencyProperty to expose the Tab Client would work but I am getting an error stating that "An InterTabClient must be provided on an InterTabController."

Public Shared ReadOnly InterTabClientProperty As DependencyProperty =
    DependencyProperty.Register("InterTabClientInstance",
                            GetType(TRInterTabClient),
                            GetType(MainWindow),
                            New PropertyMetadata(Nothing))

Public Property InterTabClientInstance As TRInterTabClient
    Get
        If GetValue(InterTabClientProperty) Is Nothing Then InterTabClientInstance = New TRInterTabClient
        Return DirectCast(GetValue(InterTabClientProperty), TRInterTabClient)
    End Get
    Set(value As TRInterTabClient)
        SetValue(InterTabClientProperty, value)
    End Set
End Property

Clearly I'm doing something wrong or misunderstanding how to accomplish what I want can anyone help me with this?

Upvotes: 2

Views: 1329

Answers (1)

James Willock
James Willock

Reputation: 2037

The InterTabClient property on InterTabController is mandatory, so you when you create a new Window, and new TabablzControl, you will need to re-set it manually, as you are not using MVVM. Excuse the C# syntax, but in your IInterTabController you could do this:

    public INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
    {
        var view = new BasicExampleTemplateWindow();            
        view.TabablzControl.InterTabController = new InterTabController()
        {
            InterTabClient = this
        };
        return new NewTabHost<Window>(view, view.TabablzControl);
    }

Notice how I set InterTabClient to the current instance.

If you are still having issues post a sample on GitHub and I'll help you fix it up.

Upvotes: 5

Related Questions