示例#1
0
 private void DataContextChangedEventHandler(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (DataContext != null && DataContext is AllTeamsViewModel)
     {
         _viewModel = DataContext as AllTeamsViewModel;
     }
 }
示例#2
0
        public AllTeamsView()
        {
            InitializeComponent();

            if (DataContext is AllTeamsViewModel)
            {
                _viewModel = DataContext as AllTeamsViewModel;
            }
            else
            {
                DataContextChanged += new DependencyPropertyChangedEventHandler(DataContextChangedEventHandler);
            }
        }