Пример #1
0
        private void ObservableComboBox()
        {
            ObservableCollection <ExampleItem> anExampleCollection =
                ((ExampleCollection)Resources["theExamples"]).ExampleItemsCollection;

            int[]    intValues    = { 1, 2, 3, 4, 5, 6, 7, 8 };
            string[] stringValues = { "a", "b", "c", "d", "e", "f", "g", "h" };

            for (int i = 0; i < intValues.Length; i++)
            {
                var anExample = new ExampleItem(intValues[i], stringValues[i]);

                anExampleCollection.Add(anExample);
            }

            // Now that everything is loaded, enable the controls
            ExampleComboBox.IsEnabled = true;

            // Select the default value in one combo box
            ExampleComboBox.SelectedIndex = 4;
        }
Пример #2
0
        private void ObservableComboBox()
        {
            ObservableCollection<ExampleItem> anExampleCollection =
                ((ExampleCollection) Resources["theExamples"]).ExampleItemsCollection;
            int[] intValues = {1, 2, 3, 4, 5, 6, 7, 8};
            string[] stringValues = {"a", "b", "c", "d", "e", "f", "g", "h"};

            for (int i = 0; i < intValues.Length; i++)
            {
                var anExample = new ExampleItem(intValues[i], stringValues[i]);

                anExampleCollection.Add(anExample);
            }

            // Now that everything is loaded, enable the controls
            ExampleComboBox.IsEnabled = true;

            // Select the default value in one combo box
            ExampleComboBox.SelectedIndex = 4;
        }