void lb_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (_targetListBoxItem != null) { _targetListBoxItem.IsSelected = false; _targetListBoxItem = null; } if (e.AddedItems != null && e.AddedItems.Count > 0) { ListBoxItem item = e.AddedItems[0] as ListBoxItem; if (item != null) { CategoryItem ci = item.Tag as CategoryItem; _item = ci; processitem(ci); } } }
public void ProcessTarget() { if (string.IsNullOrEmpty(_target)) { return; } string targetXAML = "ArcGISSilverlightSDK." + _target; int categoryIndex = 0; foreach (Category category in _categoryList) { int categoryItemIndex = 0; foreach (CategoryItem categoryItem in category.CategoryItems) { if (categoryItem.XAML.ToLower() == targetXAML.ToLower()) { _item = categoryItem; processitem(categoryItem); Expander exp = FindName(String.Format("Category_{0}", categoryIndex)) as Expander; exp.IsExpanded = true; _targetListBoxItem = FindName(String.Format("Item_{0}_{1}", categoryIndex, categoryItemIndex)) as ListBoxItem; //_targetListBoxItem.IsSelected = true; // Not working - research in progress VisualStateManager.GoToState(_targetListBoxItem, "Selected", true); return; } categoryItemIndex++; } categoryIndex++; } }
private void processitem(CategoryItem item) { _control = null; tabSample.Content = null; txtSrc.SourceCode = ""; txtXaml.SourceCode = ""; txtSrcVB.SourceCode = ""; txtDesc.Text = ""; tabPanel.SelectedIndex = 0; Type t = Type.GetType(item.XAML); if (t != null) { // Reset the IdentityManager to handle multiple samples ESRI.ArcGIS.Client.IdentityManager.Current.ChallengeMethod = null; foreach (IdentityManager.Credential crd in ESRI.ArcGIS.Client.IdentityManager.Current.Credentials) ESRI.ArcGIS.Client.IdentityManager.Current.RemoveCredential(crd); _control = System.Activator.CreateInstance(t) as UserControl; tabSample.Content = _control; SampleCaption.Text = item.ID; } HtmlPage.Window.Invoke("setParentHash", new object[] { item.XAML.Split('.')[1] }); }
public void ProcessTarget() { if (string.IsNullOrEmpty(_target)) return; string targetXAML = "ArcGISSilverlightSDK." + _target; int categoryIndex = 0; foreach (Category category in _categoryList) { int categoryItemIndex = 0; foreach (CategoryItem categoryItem in category.CategoryItems) { if (categoryItem.XAML.ToLower() == targetXAML.ToLower()) { _item = categoryItem; processitem(categoryItem); Expander exp = FindName(String.Format("Category_{0}", categoryIndex)) as Expander; exp.IsExpanded = true; _targetListBoxItem = FindName(String.Format("Item_{0}_{1}", categoryIndex, categoryItemIndex)) as ListBoxItem; //_targetListBoxItem.IsSelected = true; // Not working - research in progress VisualStateManager.GoToState(_targetListBoxItem, "Selected", true); return; } categoryItemIndex++; } categoryIndex++; } }