Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could use MEF, exporting a settings view from each view model and importing them as a list of views that you add to a stack panel or some such in your main settings view.</p> <p>A good source of info of using MEF is: <a href="http://mef.codeplex.com/wikipage?title=Guide" rel="nofollow noreferrer">http://mef.codeplex.com/wikipage?title=Guide</a></p> <p>Here is a sample program I meant to get up sooner:</p> <p>using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; using System.Reflection;</p> <pre><code>namespace zTestConsole { public interface ISimple { string Message { get; } } [Export("SimpleHello",typeof(ISimple))] public class SimpleHello : ISimple { [Export("Message")] public string Message { get { return "Silverlight rocks!"; } } } [Export("SimpleBello",typeof(ISimple))] public class SimpleBello : ISimple { [Export("Message")] public string Message { get { return "C# rocks!"; } } } public class SimpleMultiCat { [ImportMany("Message")] public IEnumerable&lt;string&gt; Messages { get; set; } } public class SimpleCat { [Import("SimpleHello")] public ISimple simple { get; set; } } class Program { private static CompositionContainer container; static void Main(string[] args) { AggregateCatalog catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly())); SimpleMultiCat cats = new SimpleMultiCat(); SimpleCat cat = new SimpleCat(); Program.container = new CompositionContainer(catalog); try { Program.container.ComposeParts(cats); foreach (string message in cats.Messages) { Console.WriteLine(message); } } catch (CompositionException ex) { Console.WriteLine(ex.ToString()); } Console.WriteLine(); try { container.ComposeParts(cat); Console.WriteLine(cat.simple.Message); } catch (CompositionException ex) { Console.WriteLine(ex.ToString()); } } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload