ItemsSource ListBox, , . - ObservableCollection < > , ListBox ViewModel. , .
, - , , , UserControl.
ViewModel ICommand ( , ). UserControl DataContext, ViewModel. , ViewModel .
,
MVVM, ICommands
( )
class ViewModelType {
public void DoSomething() { }
public ICommand DoSomethingCommand { get; set; }
public string Property { get; set; }
}
class CodeBehind {
public void EventHandler(object, args) {
(DataContext as ViewModelType).DoSomethingElseCommand.Execute();
}
}