I need to sort the strings in a ListBox, but it is bound to the view model by another component via the DataContext. So I can't directly instantiate the view model in xaml, as in this example, which uses the ObjectDataProvider:
http://www.galasoft.ch/mydotnet/articles/article-2007081301.aspx
in my xaml:
<ListBox ItemsSource="{Binding CollectionOfStrings}" />
in my view model:
public ObservableCollection<string> CollectionOfStrings
{
get { return collectionOfStrings; }
}
in another component:
view.DataContext = new ViewModel();
there is no code behind!
So using purely xaml, how would I sort the items in the ListBox? Again, the xaml doesn't own the instantiation of the view model.
Thanks!