私は現在、次のものを持っています:
public static readonly DependencyProperty IsCopyEnabledProperty =
DependencyProperty.Register(
"IsCopyEnabled",
typeof(bool),
typeof(MainWindow));
public bool IsCopyEnabled
{
get { return (bool)GetValue(IsCopyEnabledProperty); }
set { SetValue(IsCopyEnabledProperty, value); }
}
これを作成したボタンにバインドして、有効にするか無効にするかを決定します。私は通常、宣言されているクラスから IsCopyEnabled の値を変更するために次を呼び出します。
IsCopyEnabled = !IsCopyEnabled;
IsCopyEnabled の値を別のクラス (同じ名前空間) で変更する方法を考えています。