Quantcast
Channel: AvalonDock
Viewing all articles
Browse latest Browse all 2690

New Post: [Version 2.0] Navigator Window

$
0
0

Next I want to use custom navigator window in another dock manager. There can be two approaches: to disable default NW and then to show custom window on ctrl-tab or some other key combination that detected in my own code or to provide the way to use custom navigators from Avalondock. In that case it can be implemented something like this:

Interface declaration for external providers:

public interface ICustomNavigatorWindowProvider
{
    void ShowNavigatorWindow(DockingManager manager);
    bool IsNavigatorWindowActive { get; }
}

Code for docking manager:

public ICustomNavigatorWindowProvider CustomNavigatorWindowProvider { get; set; }

void ShowNavigatorWindow()
{
    try
    {
        if (CustomNavigatorWindowProvider != null)
            CustomNavigatorWindowProvider.ShowNavigatorWindow(this);
        else
        {
            _navigatorWindow = new NavigatorWindow(this) { Owner = Window.GetWindow(this), WindowStartupLocation = WindowStartupLocation.CenterOwner };//, ShowActivated = false };
            _navigatorWindow.ShowDialog();
        }
    }
    catch (System.Exception ex)
    {
        Debug.WriteLine(ex.Message);
    }
    finally
    {
        _navigatorWindow = null;
    }
    Debug.WriteLine("ShowNavigatorWindow()");
}

bool IsNavigatorWindowActive
{
    get { return (CustomNavigatorWindow != null && CustomNavigatorWindow.IsNavigatorWindowActive) || _navigatorWindow != null; }
}

What do you think?


Viewing all articles
Browse latest Browse all 2690

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>