title: Sorting ListCollectionView with CustomSort
body: <p>I'm trying to sort a <code>ListCollectionView</code> but I can't get it to work. I have my own <code>CustomSort</code> which throws the following error:  </p>
  
  <blockquote>
    <p>Cannot implicitly convert type 'SceneComparer' to 'IComparer'. An
    explicit conversion exists. (Are you missing a cast?)</p>
  </blockquote>
  
  <p>This is what my comparer looks like:</p>
  
  <pre><code>public class SceneComparer : IComparer&lt;Scene&gt;
  {
      // Assumes that a scene is either numeric, or numeric + alpha.
      private readonly Regex sceneRegEx = new Regex(@"(\d*)(\w*)", RegexOptions.Compiled);
  
      public int Compare(Scene x, Scene y)
      {
          var firstSceneMatch = this.sceneRegEx.Match(x.SceneNumber);
  
          var firstSceneNumeric = Convert.ToInt32(firstSceneMatch.Groups[1].Value);
          var firstSceneAlpha = firstSceneMatch.Groups[2].Value;
  
          var secondSceneMatch = this.sceneRegEx.Match(y.SceneNumber);
  
          var secondSceneNumeric = Convert.ToInt32(secondSceneMatch.Groups[1].Value);
          var secondSceneAlpha = secondSceneMatch.Groups[2].Value;
  
          if (firstSceneNumeric &lt; secondSceneNumeric)
          {
              return -1;
          }
  
          if (firstSceneNumeric &gt; secondSceneNumeric)
          {
              return 1;
          }
  
          return string.CompareOrdinal(firstSceneAlpha, secondSceneAlpha);
      }
  }
  </code></pre>
  
  <p>And here is the sorting in the ViewModel</p>
  
  <pre><code>private ListCollectionView _scenesNavigator;
  public ListCollectionView ScenesNavigator
  {
      get
      {
          _scenesNavigator = SceneCollectionView;
          _scenesNavigator.CustomSort = new SceneComparer(); ----&gt; ERROR
          _scenesNavigator.IsLiveSorting = true;
  
          return _scenesNavigator;
      }
      set
      {
          _scenesNavigator = value; RaisePropertyChanged();
      }
  }
  
  public SourceViewModel()
  {
          SceneCollectionView = Application.Current.Resources["SceneCollectionView"] as ListCollectionView;
  }
  </code></pre>
  
  <p>How can I solve this issue? </p>