Divelements Community
Customer discussion of all Divelements products

follow the ActiveDocument

Latest post 09-15-2008 9:15 by Tim Dawson. 1 replies.
  • 09-02-2008 20:24

    follow the ActiveDocument

    Some applications have the idea of an ActiveDocument -- they update toolbars to match the DocumentWindow that currently has the focus. It seems this mechanism of acquiring the ActiveDocument and knowing when that has changed (an ActiveDocument changed) event is absent in SandRibbon WPF. With one exception. That exception is the IsSelected dependency property on DockableWindow.

    I wrote that much and decided to pull up the code in the reflector. I discovered that the active window uses the WPF Selector primitive. That means you can subscribe to selection events with this line:

    EventManager

    .RegisterClassHandler(typeof(DocumentWindow), Selector.SelectedEvent, new RoutedEventHandler(SelectionChanged), true);

    Or so I thought. Alas, it doesn't work. I don't ever see those events come through. What am I doing wrong? Do I need to instantiate a Selector object somewhere?

  • 09-15-2008 9:15 In reply to

    Re: follow the ActiveDocument

    Your DockSite has a LastActiveWindow property and a LastActiveWindowChanged event.

    Using the Selected property is a red herring; there can be many selected windows in a layout but only one is active.

Page 1 of 1 (2 items) | RSS
Copyright © 2008 Divelements Limited
Powered by Community Server (Commercial Edition), by Telligent Systems