locked
Visual Studio 2010/2012 WPF designer extension RRS feed

  • Question

  • Hello! When I use Blend 4/5, I can create extension for Blend WPF designer like this:

    using System.ComponentModel.Composition;
    
    using Microsoft.Expression.DesignModel.Metadata;
    using Microsoft.Expression.Extensibility;
    using Microsoft.Expression.Platform;
    using Microsoft.Expression.WpfPlatform;
    
    namespace Elysium.Extension
    {
        [Export(typeof(IPackage))]
        public class Package : IPackage
        {
            private IServices _services;
    
            public void Load(IServices services)
            {
                _services = services;
    
                var platformService = _services.GetService<IPlatformService>();
                platformService.PlatformCreated += Register;
            }
    
            private void Register(object sender, PlatformEventArgs e)
            {
                var wpf = e.Platform as WpfPlatform;
                if (wpf != null)
                {
                    wpf.Metadata.AddAssemblyGroupMapping(AssemblyGroup.ExtendedControls, "Elysium.Extension");
                    wpf.InstanceBuilderFactory.Register(new CustomWindowInstanceBuilder());
                }
            }
    
            public void Unload()
            {
            }
        }
    }

    In this code I subscribe to IPlatform service and when it's updated I register my custom WindowInstanceBuilder via WPFPlatform object.

    How I can do this for Visual Studio 2010/2012 designer?

    Thank you.



    Saturday, November 17, 2012 10:17 PM

All replies