次のようなクラス Cell があります。
public Color color{get { return colorr; }
set { colorr = value;
if (this.PropertyChanged != null){
this.PropertyChanged(this, new PropertyChangedEventArgs("color"));
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
キューブを生成するために、viewport3D に多くの「セル」を追加しています。そして、細胞の色は時間の経過とともに変化します。私の質問は、セルが変更されるたびにセルを再描画する代わりに、コードでセルの色をソリッドブラシにバインドできますか?
私はこのようなものを持っていますが、うまくいきません。
Binding b = new Binding();
b.Source = cell.color;
SolidColorBrush solidBrush = new SolidColorBrush();
BindingOperations.SetBinding(solidBrush, SolidColorBrush.ColorProperty, b);
Material material = new DiffuseMaterial(solidBrush);
セルの色が変わると solidBrush の色が変わるため、viewport3D の立方体の色が変わると思います。しかし、そうではありません。
ありがとう - デビッド