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.
To open this page, choose the Tools menu and then choose Options. To access the XAML Designer property page, choose the XAML Designer node. Settings for the XAML Designer are applied when you open the document. So, if you make changes to the settings, you need to close and then reopen Visual Studio to see the changes.
To open the XAML Designer, right-click a XAML file in Solution Explorer and choose View Designer. to switch which window appears on top: either the artboard or the XAML editor.
To begin editing your first XAML file, use Visual Studio or Visual Studio for Mac to create a new Xamarin. Forms solution. (Select the tab below corresponding to your environment.) In the Configure your new project window, set the Project name to XamlSamples (or whatever your prefer), and click the Create button.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With