protected override void OnBindingContextChanged() { typePicker.SetBinding(PickerEx.SelectedItemProperty, new Binding(path: "Time.msdyn_type", converter: new OptionSetConverter <msdyn_timeentrytype>(), mode: BindingMode.TwoWay)); typePicker.ItemsSource = ViewModel.GetAllOptionSetValues <msdyn_timeentrytype>(); projectPicker.SetBinding(PickerEx.SelectedItemProperty, new Binding(path: "Time.msdyn_project", converter: new EntityPreviewConverter <msdyn_project>(), converterParameter: this.ViewModel, mode: BindingMode.TwoWay)); projectPicker.ItemsSource = ViewModel.GetReferenceKeys <msdyn_project>(msdyn_project.EntityLogicalName); projectTaskPicker.SetBinding(PickerEx.SelectedItemProperty, new Binding(path: "Time.msdyn_projectTask", converter: new EntityPreviewConverter <msdyn_projecttask>(), converterParameter: this.ViewModel, mode: BindingMode.TwoWay)); this.setEditabilityOfControls(ViewModel.CanEdit()); base.OnBindingContextChanged(); }
protected override void OnBindingContextChanged() { categoryPicker.SetBinding(PickerEx.SelectedItemProperty, new Binding(path: "Expense.msdyn_ExpenseCategory", converter: new Common.View.ValueConverter.EntityPreviewConverter <msdyn_expensecategory>(), converterParameter: this.ViewModel, mode: BindingMode.TwoWay)); categoryPicker.ItemsSource = ViewModel.GetReferenceKeys <msdyn_expensecategory>(msdyn_expensecategory.EntityLogicalName); projectPicker.SetBinding(PickerEx.SelectedItemProperty, new Binding(path: "Expense.msdyn_Project", converter: new Common.View.ValueConverter.EntityPreviewConverter <msdyn_project>(), converterParameter: this.ViewModel, mode: BindingMode.TwoWay)); projectPicker.ItemsSource = ViewModel.GetReferenceKeys <msdyn_project>(msdyn_project.EntityLogicalName); currencyPicker.SetBinding(PickerEx.SelectedItemProperty, new Binding(path: "Expense.TransactionCurrencyId", converter: new Common.View.ValueConverter.EntityPreviewConverter <TransactionCurrency>(), converterParameter: this.ViewModel, mode: BindingMode.TwoWay)); currencyPicker.ItemsSource = ViewModel.GetReferenceKeys <TransactionCurrency>(TransactionCurrency.EntityLogicalName); this.IsEnabled = ViewModel.CanEdit(); projectPicker.IsEnabled = this.IsEnabled; categoryPicker.IsEnabled = this.IsEnabled; currencyPicker.IsEnabled = this.IsEnabled; transactionDatePicker.IsEnabled = this.IsEnabled; descriptionEditor.IsEnabled = this.IsEnabled; amountEntry.IsEnabled = this.IsEnabled; salesTaxEntry.IsEnabled = this.IsEnabled; base.OnBindingContextChanged(); }