title: wpf sorting combobox item in alphabetical order
body: <p>I have got combobox. The items within this combobox is coming from database and I am trying to sort it in alphabetical order but unable to do so. Can someone please help figuring out how this can be achieved? </p>
  
  <pre><code>private ObservableCollection&lt;StudentModules&gt; modules;
  
  public StudentModule()
          {
              InitializeComponent();
              DataContext = this;
              Modules = new ObservableCollection&lt;StudentModules&gt;();
              ModuleNames.ItemsSource = modules;
  
              IDataAccess&lt;ModulesFinder, StudentModules&gt; moduleRetriever = ((IDataManager)Application.Current.Properties["Database”]).GetDataAccessor&lt;ModuleFinder, StudentModules&gt;();
  
              foreach (StudentModules module in retrieve.AllItems())
              {
                  Modules.Add(module);
              }   
          }
  </code></pre>
  
  <p>XAML:</p>
  
  <pre><code>&lt;ComboBox Name="ModuleNames" &gt;
                      &lt;ComboBox.SelectedItem&gt;
                          &lt;Binding Path="ModuleDetails" NotifyOnValidationError="True"&gt;
                              &lt;Binding.ValidationRules&gt;
                                  &lt;validators:IsMandatoryValidation FieldName="Module Names"/&gt;
                              &lt;/Binding.ValidationRules&gt;
                          &lt;/Binding&gt;
                      &lt;/ComboBox.SelectedItem&gt;
                  &lt;/ComboBox&gt;
  </code></pre>