C# に次の構造体定義があるとします。
public struct TimeSlotInfo
{
public int TimeSlotID;
public int StartMin;
public int CalcGridColumn;
public string BackgroundCol;
public bool ToDisable;
}
そして、私は次のようなlinqクエリを持っています:
var TimeSlotsInfo =
from ts in datacon.TimeSlots
select new TimeSlotInfo
{
TimeSlotID = ts.TimeSlotID,
StartMin = ts.StartMin,
CalcGridColumn = CalcTimeSlotGridColumn(ts.StartMin),
BackgroundCol = ts.ColorName,
ToDisable = false
};
たとえば、ListBox の ItemsSource プロパティを以下のように設定した場合:
lstBox.ItemsSource = TimeSlotsInfo;
さて、上記のクエリ結果から「BackgroundCol」フィールドを参照するバインディング パスを設定するにはどうすればよいでしょうか。
{Binding Path=TimeSlotInfo.BackgroundCol}、{Binding Path=TimeSlotInfo/BackgroundCol}、そして最後に {Binding Path=BackgroundCol} を試しました...どれも機能していないようです..
誰でも助けることができますか?例をできるだけ単純化しようとしました。私の問題が十分に明確であることを願っています。前もって感謝します。