全て、
DataContext のオブジェクトから StaticResource を作成することは可能ですか (コード ビハインドを追加せずに)? たとえば、UserControl の DependencyProperty を考えてみましょう。
public static DependencyProperty ViewModelProperty = DependencyProperty.Register("ViewModel", typeof(IVMHeaderGeneric), typeof(UIHeader), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
public IVMHeaderGeneric ViewModel
{
get
{
return (IVMHeaderGeneric)this.GetValue(ViewModelProperty);
}
set
{
this.SetValue(ViewModelProperty, value);
}
}
IVMHeaderGeneric
このユーザー コントロールのコンシューマーによってクラスとしてインスタンス化されるインターフェイスです。
私がする必要があるのは、どういうわけか (できればコード ビハインドなしで)、これを UserControl のリソースに追加して、DataContext を継承しない UIElements でデータ バインディングを実行できるようにすることです (つまり、DataGridColumn が思い浮かびます)。
前もって感謝します。