Пример #1
0
        private void Bind()
        {
            BindingConverterDouble bindingConverterDouble = new BindingConverterDouble();
            BindingConverterInt32  bindingConverterInt32  = new BindingConverterInt32();
            BindingConverterPrice  bindingConverterPrice  = new BindingConverterPrice();

            Binding binding = new Binding()
            {
                Source = database, Path = new PropertyPath("Name")
            };

            TextBlockDatabaseName.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("Name"), Mode = BindingMode.OneWay
            };
            TextBlockMedicineName.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("Type"), Mode = BindingMode.OneWay
            };
            TextBlockMedicineType.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("AgeRestrictions"), Mode = BindingMode.OneWay
            };
            TextBlockMedicineAgeRestrictions.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("Intended"), Mode = BindingMode.OneWay
            };
            TextBlockMedicineIntended.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("Composition"), Mode = BindingMode.OneWay
            };
            TextBlockMedicineComposition.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("Comments"), Mode = BindingMode.OneWay
            };
            TextBlockMedicineComments.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("Price"), Mode = BindingMode.OneWay, Converter = bindingConverterPrice
            };
            TextBlockMedicinePrice.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("RM_Level"), Mode = BindingMode.OneWay
            };
            TextBlockMedicineRM_Level.SetBinding(TextBlock.TextProperty, binding);


            if (medicine.RM_Reimbursed)
            {
                StackPanelMedicineRM_FundingLimit.Visibility    = Visibility.Visible;
                StackPanelMedicinePriceAfterDiscount.Visibility = Visibility.Visible;
            }

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("RM_FundingLimit"), Mode = BindingMode.OneWay, Converter = bindingConverterPrice
            };
            TextBlockMedicineRM_FundingLimit.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = medicine, Path = new PropertyPath("PriceAfterDiscount"), Mode = BindingMode.OneWay, Converter = bindingConverterPrice
            };
            TextBlockMedicinePriceAfterDiscount.SetBinding(TextBlock.TextProperty, binding);


            ListViewReplacements.ItemsSource = medicine.replacements;
        }
        private void Bind()
        {
            BindingConverterDouble converterDouble = new BindingConverterDouble();
            BindingConverterInt32  converterInt32  = new BindingConverterInt32();
            BindingConverterPrice  converterPrice  = new BindingConverterPrice();


            Binding binding = new Binding()
            {
                Source = database, Path = new PropertyPath("Name")
            };

            TextBlockDatabaseName.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = databaseSearch, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Path = new PropertyPath("Name")
            };
            TextBoxSearchMedName.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = databaseSearch, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Path = new PropertyPath("Type")
            };
            TextBoxSearchMedType.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = databaseSearch, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Converter = converterDouble, Path = new PropertyPath("MaxPrise")
            };
            TextBoxSearchMedPrice.SetBinding(TextBox.TextProperty, binding);


            binding = new Binding()
            {
                Source = databaseSearch, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Path = new PropertyPath("Intended")
            };
            TextBoxSearchMedIntended.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = databaseSearch, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Path = new PropertyPath("Composition")
            };
            TextBoxSearchMedComposition.SetBinding(TextBox.TextProperty, binding);


            binding = new Binding()
            {
                Source = databaseSearch, Mode = BindingMode.TwoWay, Path = new PropertyPath("Reimbursed")
            };
            CheckBoxSearchMedReimbursed.SetBinding(CheckBox.IsCheckedProperty, binding);

            ListViewDatabase.ItemsSource = databaseSearch.displayedMedBase;


            if (TestingMode)
            {
                SeparatorTestingMode.Visibility = Visibility.Visible;
                ImageButtonTESTING_R.Visibility = Visibility.Visible;
                ImageButtonTESTING_M.Visibility = Visibility.Visible;
            }
        }
        private void Bind()
        {
            BindingConverterDouble bindingConverterDouble = new BindingConverterDouble();
            BindingConverterInt32  bindingConverterInt32  = new BindingConverterInt32();
            BindingConverterPrice  bindingConverterPrice  = new BindingConverterPrice();

            Binding binding = new Binding()
            {
                Source = database, Path = new PropertyPath("Name")
            };

            TextBlockDatabaseName.SetBinding(TextBlock.TextProperty, binding);

            binding = new Binding()
            {
                Source = newMedicine, Path = new PropertyPath("Name"), Mode = BindingMode.TwoWay
            };
            TextBoxMedicineName.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = newMedicine, Path = new PropertyPath("Type"), Mode = BindingMode.TwoWay
            };
            TextBoxMedicineType.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = newMedicine, Path = new PropertyPath("AgeRestrictions"), Mode = BindingMode.TwoWay, Converter = bindingConverterInt32
            };
            TextBoxMedicineAgeRestrictions.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = newMedicine, Path = new PropertyPath("Intended"), Mode = BindingMode.TwoWay
            };
            TextBoxMedicineIntended.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = newMedicine, Path = new PropertyPath("Composition"), Mode = BindingMode.TwoWay
            };
            TextBoxMedicineComposition.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = newMedicine, Path = new PropertyPath("Comments"), Mode = BindingMode.TwoWay
            };
            TextBoxMedicineComments.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = newMedicine, Path = new PropertyPath("Price"), Mode = BindingMode.TwoWay, Converter = bindingConverterDouble
            };
            TextBoxMedicinePrice.SetBinding(TextBox.TextProperty, binding);

            ComboBoxMedicineRM_LevelChoice.ItemsSource   = levelOfFundingList;
            ComboBoxMedicineRM_LevelChoice.SelectedIndex = MeidcineRM_LevelStart;

            ListViewReplacements.ItemsSource = newMedicine.replacements;

            if (newMedicine.RM_Reimbursed)
            {
                StackPanelRM_FundingLimit.Visibility    = Visibility.Visible;
                StackPanelPriceAfterDiscount.Visibility = Visibility.Visible;
            }

            binding = new Binding()
            {
                Source = newMedicine, Path = new PropertyPath("RM_FundingLimit"), Mode = BindingMode.TwoWay, Converter = bindingConverterDouble
            };
            TextBoxMedicineRM_FundingLimit.SetBinding(TextBox.TextProperty, binding);

            binding = new Binding()
            {
                Source = newMedicine, Path = new PropertyPath("PriceAfterDiscount"), Mode = BindingMode.OneWay, Converter = bindingConverterPrice
            };
            TextBlockPriceAfterDiscount.SetBinding(TextBlock.TextProperty, binding);


            ComboBoxReplacements.ItemsSource = database.medBase;
        }