private void BetweenPrimaryKeysExtensionExamples_Shown(object sender, EventArgs e)
        {
            using (var context = new NorthwindContext())
            {
                var countries = context.Countries.Select(country => country).ToList();

                countries.Insert(0, new Countries()
                {
                    CountryIdentifier = -1, Name = "Select"
                });
                CountryComboBox.DataSource    = countries;
                CountryComboBox.SelectedIndex = CountryComboBox.FindString("UK");
            }
        }
Exemple #2
0
        public RegisterPanel()
        {
            InitializeComponent();

            // Generar lista de años (100 años atrás del día de hoy)
            BirthYearComboBox.BeginUpdate();
            for (
                Int32 year = DateTime.Now.Year, bottomYear = DateTime.Now.Year - 100;
                year > bottomYear;
                year--
                )
            {
                BirthYearComboBox.Items.Add(year);
            }
            BirthYearComboBox.EndUpdate();

            // Generar lista de peso
            WeightComboBox.BeginUpdate();
            for (int i = 30; i < 301; i++)
            {
                WeightComboBox.Items.Add(
                    String.Format("{0} kg", i)
                    );
            }
            WeightComboBox.EndUpdate();

            // Generar lista de estatura
            HeightComboBox.BeginUpdate();
            for (Int16 i = 40; i < 231; i++)
            {
                String s = i.ToString().PadLeft(3, '0');
                HeightComboBox.Items.Add(
                    String.Format(
                        "{0}.{1} m",
                        s.Substring(0, 1),
                        s.Substring(1)
                        )
                    );
            }
            HeightComboBox.EndUpdate();

            // Generar lista de ubicación geográfica
            CountryComboBox.BeginUpdate();
            foreach (var country in Geography)
            {
                CountryComboBox.Items.Add(country);
            }
            CountryComboBox.EndUpdate();
        }
Exemple #3
0
        private void BindData()
        {
            var countries = new List <Country>()
            {
                new Country()
                {
                    Id   = -1,
                    Name = Resources.CustomerReportSummaryReportStrings.AnyCountryText
                }
            }
            .Concat(UnitOfWork.Data.Countries.GetAll())
            .ToList();

            CountryComboBox.Bind(countries, "Name");
            CountryComboBox.SelectedIndex = 0;
        }
 private void RefreshComboBoxes()
 {
     BrandComboBox?.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget();
     DimensionComboBox?.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget();
     CountryComboBox?.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget();
 }