SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

How does the Extension architecture in WPF Designer work?

Last post 06-20-2008 5:15 PM by DanielGrunwald. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-22-2008 12:57 PM

    How does the Extension architecture in WPF Designer work?

    Hi,

    I just want to know how the extension architectur for designitem really work. How does the designer load extension for the DesignItem? I've taken a look at existing extensions, but I couldn't understand how the architecture work. E.g. the ResizeThumbExtension, how would it be loaded? I would really appreciate, if someone help me to undertand that. 

    Thank in advance

    Filed under:
  • 06-20-2008 5:15 PM In reply to

    Re: How does the Extension architecture in WPF Designer work?

    Extension loading is controlled with the ExtensionFor and ExtensionServer attributes.

     ResizeThumbExtension has the following attributes:

    [ExtensionServer(typeof(PrimarySelectionExtensionServer))] // inherited from PrimarySelectionAdornerProvider
    [ExtensionFor(typeof(FrameworkElement))]

    Responsible for extension loading is the ExtensionManager. It listenes to IComponentService.ComponentRegistered, and associates (via DesignItem.SetExtensionServers) the design item of newly created components with all applicable extension servers (there is only a single instance of each extension server (per design context)).

    Extension servers control whether an extension should be applied to a design item (decided in the ShouldApplyExtensions method). Some extension servers make their extensions alive for the whole lifetime of the design item; others just when a certain condition is fulfilled. The PrimarySelectionExtensionServer creates extensions only for the item that is the primary selection. Whenever the primary selection is changed, the PrimarySelectionExtensionServer unloads its extensions on the old primary selected item and creates its extensions on the new primary selected item.

    Daniel Grunwald
Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.