20

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.

Aleksandr Vishnyakov
  • 1,872
  • 5
  • 23
  • 39
  • Can you explain more about what this extension should accomplih? – Alan Nov 20 '12 at 15:48
  • 1
    Visual Studio and Blend uses fake window for WPF designer. I need to change template of this, but I can do it only via class that inherits WindowInstanceBuilder, because "fake window" template can be changed only in WindowInstanceBuilder.InstantiateTargetType method. – Aleksandr Vishnyakov Nov 21 '12 at 05:25
  • You can choose a WPF User Control Library from the Windows section from Visual Studio 2010. – okenshield Jan 14 '13 at 17:26
  • I need to create Visual Studio Designer extension, not custom user control. – Aleksandr Vishnyakov Jan 15 '13 at 22:08
  • Are these any good? http://msdn.microsoft.com/en-us/library/dd885119.aspx http://blogs.msdn.com/b/tilovell/archive/2012/10/04/wf4-vs-workflowdesigner-extensions-in-visual-studio-2012.aspx http://www.codeproject.com/Articles/75961/Building-extensions-for-Expression-Blend-4-using-M – okenshield Jan 16 '13 at 11:06
  • No, I need to build extension for _Visual Studio_ WPF designer. I this extension I need to use WPFPlatform class. – Aleksandr Vishnyakov Jan 16 '13 at 12:45

1 Answers1

1

For some hints on Visual Studio Extensibility, see "Visual Studio 2010 addin writing articles/tutorials?" . The Visual Studio SDK may have the information you need.

If this works for you, you can extend the solution to Visual Studio 2012.

Community
  • 1
  • 1
Hybos
  • 156
  • 12
  • 2
    No, Visual Studio SDK documentation doesn't contains information about Visual Studio Designer WPF Platform extensibility. – Aleksandr Vishnyakov Jan 14 '13 at 16:57
  • Such as you say, it seems that the VS does not have a great support to extend the WPF editor. I've searched on SKD documentation and could not find any information or interface in some way for extending this. I think the only way is implement your own remoting infrastructure between VS and the WPF Designer, since the editor window is a "fake window" as you say and runs in its own AppDomain. – Hybos Jan 18 '13 at 12:03