[vs2010とExpressionBlendv4を使用]
こんにちは-JoshSmithのコンセプトを使用して、WPFとBlendにいくつかの設計時データをロードしようとしています:http://joshsmithonwpf.wordpress.com/2010/04/07/assembly-level-initialization-at-design-time/ 例
[AttributeUsage(AttributeTargets.Assembly)]
public class DesignTimeBootstrapperAttribute : Attribute
{
public DesignTimeBootstrapperAttribute(Type type)
{
var dep = new DependencyObject();
Debug.WriteLine("here..?");
if (DesignerProperties.GetIsInDesignMode(dep))
{
// TODO: Design-time initialization…
IBootstrapper instance = Activator.CreateInstance(type) as IBootstrapper;
if (instance != null)
{
instance.Run();
}
}
}
}
AppBootstrapperがMefBootstrapperを拡張するAssemblyInfo.csの私の属性を使用します。
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: DesignTimeBootstrapper(typeof(AppBootstrapper))]
Blendのサンプルデータを使用したくありません。a)ObservableCollectionのデータを作成していないようです。b)定義上、デザインモードになっているため、状況は大きく変わりますが、'生成されたデータ' しない。
とにかく、何も起こっていないようです。
Q1:ブートストラッパーの設計時の初期化をデバッグするにはどうすればよいですか?Q2:View XAMLに追加のブレンド名前名/属性などが必要ですか?
(私のブートストラッパーでは、RunTimeServiceをDesignTimeServiceに置き換えたい別のモジュールを登録し、IServiceインターフェイスをエクスポートしています)。
TIA