예제 #1
0
        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();
        }