You do not need anything, only the data that you use. You should not be wondering what the control looks like. (You do not want to be combined with this control)
<ListBox ItemsSource="{Binding MyItems}" SelectedItem="{Binding MyItem}" />
may be:
<SexyWoman Legs="{Binding MyItems}" Ass="{Binding MyItem}" />
and it will also work.
ListBox has this class as a DataContext:
class DummyClass : INotifyPropertyChanged { private MyItem _myItem; public MyItem MyItem { get { return _myItem; } set { _myItem = value; NotifyPropertyChanged("MyItem"); } } private IEnumerable<MyItem> _myItems; public IEnumerable<MyItem> MyItems { get { return _myItems; } } public void FillWithItems() { _myItems = ... NotifyPropertyChanged("MyItems"); MyItem = _myItems.FirstOrDefault(); } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(string value) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(value)); } } #endregion }
PaN1C_Showt1Me
source share