0
綁定類集合屬性這是我的Globals類通過XAML
public class Globals
{
private static Globals instance = new Globals();
protected Globals()
{
}
public static Globals Instance
{
get { return instance; }
}
public TrackList Tracklist = new TrackList();
}
這是曲目在智能代碼:
public class TrackList : SettingAttribute {
public TrackList()
{
this.tracks = new ObservableCollectionExt<Track>();
}
protected ObservableCollectionExt<Track> tracks;
public ObservableCollectionExt<Track> Tracks
{
get
{
return tracks;
}
}
public class Track : ICloneable
{
protected Track()
{
// Track instance is achieved by GetTrack
}
public GetTrack(string path)
{
// code implementation here
}
}
}
我希望綁定在Globals.Instance.Tracklist.Tracks ListView使用XAML。
通過運行時,是很容易使用的ItemSource屬性
lv.ItemsSource = Globals.Instance.Tracklist.Tracks;
但使用XAML我與幾個代碼嘗試,但沒有一個是好的。
Syned我follewed您的解決方案和有用! 也非常感謝所有的答案。 – user1649247
歡迎您! – syned