他の 2 つのオブジェクトから作成された ObservableCollection をバインドしようとしたときに、いくつかの問題が発生しました。最初に ActiveSketchs をバインドする必要があります。次に、スケッチ (ActivesSketchs.Union(InactiveSketchs) です) を個別にバインドする必要があります。
以下のコードは動くと思っていたのですが、うまくいきません。ActiveSketch バインディングは正しく機能しますが、Sketchs バインディングは機能しません:
private ObservableCollection<Sketch> _sketchs;
public ObservableCollection<Sketch> Sketchs
{
get { return _sketchs = new ObservableCollection<Sketch>(ActiveSketchs.Union(InactiveSketchs)); }
set { _sketchs = value; }
}
private ObservableCollection<Sketch> _activeSketchs;
public ObservableCollection<Sketch> ActiveSketchs
{
get { return _activeSketchs; }
set { _activeSketchs = value; }
}
private ObservableCollection<Sketch> _inactiveSketchs;
public ObservableCollection<Sketch> InactiveSketchs
{
get { return _inactiveSketchs; }
set { _inactiveSketchs = value; }
}
ソースアイテムを設定する方法は次のとおりです。
HeadbandRight.ItemsSource = Sketchs;
HeadbandLeft.ItemsSource = Sketchs;
MainScatterViewer.ItemsSource = ActiveSketchs;