How to place instance of window in LayoutAnchorable AvalonDock 2

后端 未结 1 1438
[愿得一人]
[愿得一人] 2021-01-21 02:34

I\'m upgrading AvalonDock in a WPF C# application (not MVVM) from 1.3 to 2.0. In 1.3 I was able to place custom windows as long as used DockableContent: XAML:

&l         


        
相关标签:
1条回答
  • 2021-01-21 03:05

    AvalonDock is changed a lot with new version. In AD 2.0 you have two option: 1) The simplest one is to create a standard UserControl (in your case JournalWindow derived from UserControl instead of DockableContent) and put the control inside the LayoutAnchorable (as its Content). Sample code:

    <UserControl x:Class="Test.JournalWindow" ...>
    ...
    </UserControl>
    
    <LayoutAnchorable Title="My Journal Window">
       <testNamespace:JournalWindow/>
    </LayoutAnchorable>
    

    2) The recommended one is to use a MVVM approach and for this I'd point you to the sample project MVVMTestApp attached to AvalonDock library: http://avalondock.codeplex.com/downloads/get/558780

    Ado

    0 讨论(0)
提交回复
热议问题