title: How to subclass a ListView with XAML set CachingStrategy in Xamarin.Forms
body: <p>I am setting the <code>CachingStrategy</code> of my own <code>ListView</code> inherited subclass in a XAML file.</p>
  
  <p>But because the <code>CachingStrategy</code> has a private setter and because it is set using the <code>Parameter</code> attribute in one of it's constructors, which for some reason is declared as internal and sealed, there seems to be no way to subclass a <code>ListView</code>.</p>
  
  <p>The following compiler error is generated:</p>
  
  <blockquote>
    <p>No property, bindable property, or event found for 'CachingStrategy', or mismatching type between value and property.</p>
  </blockquote>
  
  <p>Is this intentional? What's the reason for the <code>Parameter</code> attribute to be internal and more importantly, is there a clean way to subclass a <code>ListView</code>?</p>
  
  <p>As a workaround, I ended up doing the following, which works:
  </p>
  
  <pre><code>public class MyListView : ListView
  {
      public new ListViewCachingStrategy CachingStrategy
      {
          get =&gt; base.CachingStrategy;
          set =&gt; GetType().BaseType.GetProperty(nameof(CachingStrategy))
                          .SetValue(this, value);
      }
  }
  </code></pre>