Пример #1
0
        private void OnCategoriesListLoaded(object sender, RoutedEventArgs e)
        {
            // If there is a category selected already, we want the view to update
            // the scroll position to show it.
            if (_viewModel.SelectedAccessoryCategory != null)
            {
                // MainScrollViewer control holds both the hero images and categories,
                // so we need to find the offset of the selected category in
                // the parent ScrollViewer control.
                var container =
                    CategoriesList.ContainerFromItem(_viewModel.SelectedAccessoryCategory) as FrameworkElement;

                if (container != null)
                {
                    var focusedVisualTransform = container.TransformToVisual(MainScrollViewer);
                    var transformPoint         = focusedVisualTransform.TransformPoint(new Point(0, 0));

                    // Now adjust the scroll position.
                    MainScrollViewer.ChangeView(null, transformPoint.Y, null, true);
                }
            }
        }
Пример #2
0
 private void ChartsIndex_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     MainScrollViewer.ChangeView(null, 0, null);
 }