public FieldAreaList() { InitializeComponent(); //Empty DataContext preload to avoid System.Windows.Data Error: 40 : BindingExpression path error DataContext = new FieldAreaListVM(CaseType.Unknown); Loaded += FieldAreaList_Loaded; Application.Current.Exit += CurrentOnExit; }
private void FieldAreaList_Loaded(object sender, RoutedEventArgs e) { if (!_dataContextLoaded) { DataContext = new FieldAreaListVM(CaseType); _dataContextLoaded = true; } if (_tabIdentifier == null) { _tabIdentifier = this.Name; } if (!_columnsLoaded) { LoadColumnState(); } }