Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. public class SomeClass : INotifyPropertyChanged
  2. {
  3. public SomeClass() {}
  4.  
  5. public IList<string> Categories
  6. {
  7. get
  8. {
  9. return _categories;
  10. }
  11. set
  12. {
  13. _categories = value;
  14. OnPropertyChanged(nameof(Categories));
  15. }
  16. }
  17.  
  18. public IList<string> Forms
  19. {
  20. get
  21. {
  22. return _forms;
  23. }
  24. set
  25. {
  26. _forms = value;
  27. OnPropertyChanged(nameof(Forms));
  28. }
  29. }
  30.  
  31. public void OnPropertyChanged(string propertyName)
  32. {
  33. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  34. }
  35. }
  36.  
  37. <Window.Resources>
  38. <local:SomeClass x:key="MyClass"/>
  39. </Window.Resources>
  40.  
  41. <ToolBarPanel x:Name="myToolStripName" DataContext="{StaticResource MyClass}">
  42. <ToolBarTray>
  43. <ToolBar Height="25px">
  44. <ComboBox x:Name="cboCategories"
  45. ItemsSource="{Binding Path=Categories}"
  46. SelectionChanged="CboCategories_SelectionChanged" />
  47. <ComboBox x:Name="cboForms"
  48. ItemsSource="{Binding Path=Forms}" />
  49. </ToolBar>
  50. </ToolBarTray>
  51. </ToolBarPanel>
  52.  
  53. private void CboCategories_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
  54. {
  55. string categoryName = e.AddedItems[0].ToString();
  56. if (!string.IsNullOrEmpty(categoryName))
  57. {
  58. [problem: MyClass/SomeClass].GetFormNames(categoryName);
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement