コンテンツ コントロールのコンテンツ プロパティにバインドするにはどうすればよいですか?
カスタム コントロールを作成しました:
public class CustomControl
{
// Dependency Properties
public int MyProperty
{
get { return (int)GetValue(MyPropertyProperty); }
set { SetValue(MyPropertyProperty, value); }
}
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.Register("MyProperty", typeof(int), typeof(MainViewModel), new PropertyMetadata(0));
}
ViewModel で、このカスタム コントロールのタイプのプロパティを作成しました。
public CustomControl CustomControl { get; set; }
ビューでは、このプロパティをコンテンツ コントロールにバインドします。
<ContentControl x:Name="Custom" Content="{Binding CustomControl}"></ContentControl>
コンテンツ コントロールのコンテンツ プロパティにバインドするにはどうすればよいでしょうか。