The XAML below is basically trying to make a list of Button
s (rendered from the Name
property of objects in the Views
collection in th
I think you have to do it manually in code-behind.
XAML
Code-behind
private void ViewListButton_Click(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
ICollectionView view = CollectionViewSource.GetDefaultView(ViewList.ItemsSource);
view.MoveCurrentTo(button.DataContext);
}
If you're using the MVVM pattern and/or you don't want to use code-behind, you could bind the button's Command
to a command in your ViewModel, as suggested by Will