私は、DataGridのデータソースをObservableCollection of cellsにバインドする方法を理解しようとしています。特に、私は以下のクラスのインスタンスを保持のObservableCollection持っている:私のDataGridでWPF DataGrid - 'cells'のコレクションにバインド
public class Option : INotifyPropertyChanged
{
public Option()
{
}
// +-+- Static Information +-+-
public double spread = 0;
public double strike = 0;
public int daysToExpiry = 0;
public int put_call; // 0 = Call, 1 = Put
// Ticker References
public string fullTicker = "";
public string underlyingTicker = "";
//+-+-Properties used in Event Handlers+-+-//
private double price = 0;
public double Price
{
get { return price; }
set
{
price = value;
NotifyPropertyChanged("Price");
}
}
//+-+-+-+- Propoerty Changed Event & Hander +-+-+-+-+-//
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
}
を、私は(私はTemplateColumnsに価格と、各セルにおける「ストライク」の変数を使用しています)、これらのクラスを表示したいです"underlyingTicker" [4文字ストリング]と "spread" [バックグラウンドコーディングで定義された6つの可能な値のうちの1つを取ります]によってグループ化されます。
私はのObservableCollectionにDataGridのDataContextのをバインドする際に、現在、それは行として各「オプション」を示している - と私は上のペアのグループに何を指定する方法を見つけ出すことはできません...
この私のデータグリッドは次のようになります:
ありがとうございました - kcross!
あなたのDataGridのItemSource =何{バインディング...}、のように見えるあなたコラムのにも少なくとも一つのコードサンプルと、それはですバインディング?また、どのようなexacltyあなたが意味する: "と私はペアをグループ化する方法を指定する方法を把握することはできません" –