//Other events=================================================== private void AppsManagerWindow_Activated(object sender, EventArgs e) { if (_ItemToSelect != null) { AppList.ScrollIntoView(_ItemToSelect); AppList.Focus(); var cont = AppList.ItemContainerGenerator.ContainerFromItem(_ItemToSelect) as FrameworkElement; cont.Focus(); _ItemToSelect = null; } }
//App management tab events=================================================== private void BtnAddApp_Click(object sender, RoutedEventArgs e) { AppType appType = AppTypeSelector.SelectedItem as AppType; if (appType != null) { _Controller.AddAppInfo(_AppGroup, appType); AppList.Focus(); AppList.SelectedIndex = AppList.Items.Count - 1; AppList.ScrollIntoView(AppList.Items[AppList.Items.Count - 1]); } //ListBoxItem lbi = // (ListBoxItem)(AppList.ItemContainerGenerator.ContainerFromItem(AppList.Items.CurrentItem)); //// Getting the ContentPresenter of myListBoxItem //ContentPresenter myContentPresenter = FindVisualChild<ContentPresenter>(lbi); //// Finding textBlock from the DataTemplate that is set on that ContentPresenter //DataTemplate myDataTemplate = myContentPresenter.ContentTemplate; //Grid myTextBlock = (Grid)myDataTemplate.FindName("GridT", myContentPresenter); }