title: WPF Webview's IsPrivateNetworkClientServerCapabilityEnabled ignored when using ItemTemplate
body: <p><strong>This simple way of doing is working fine</strong></p>
  
  <p>If I use a <a href="https://blogs.windows.com/msedgedev/2018/05/09/modern-webview-winforms-wpf-apps/" rel="nofollow noreferrer">WebView</a>, put <code>IsPrivateNetworkClientServerCapabilityEnabled</code> to <code>true</code>, and load a local network website, it will load properly.</p>
  
  <pre><code>&lt;WPF:WebView Source="http://localnetworkwebsite"  
              NavigationStarting="Wvc_NavigationStarting" 
              NavigationCompleted="Wvc_NavigationCompleted" 
              IsPrivateNetworkClientServerCapabilityEnabled="True" /&gt;
  </code></pre>
  
  <p><strong>This way of doing is NOT working</strong></p>
  
  <p>In my application, I want to manage several webpage simultaneously (like tabs on a standalone browser), so I use an <code>ItemControl</code> to instantiate the WebView's count I need (this number is not always the same).</p>
  
  <pre><code>&lt;ItemsControl x:Name="ItemsWebview" ItemsSource="{Binding WebviewsDataSource}"&gt;
  
      &lt;ItemsControl.ItemsPanel&gt;
          &lt;ItemsPanelTemplate&gt;
              &lt;Grid&gt;&lt;/Grid&gt;
          &lt;/ItemsPanelTemplate&gt;
      &lt;/ItemsControl.ItemsPanel&gt;
  
      &lt;ItemsControl.ItemTemplate&gt;
          &lt;DataTemplate&gt;
  
              &lt;!--Item--&gt;
              &lt;WPF:WebView Visibility="{Binding Visibility}" Source="{Binding Source}"  
                              NavigationStarting="Wvc_NavigationStarting" 
                              NavigationCompleted="Wvc_NavigationCompleted" 
                              IsPrivateNetworkClientServerCapabilityEnabled="True" /&gt;
              &lt;!--End Item--&gt;
  
          &lt;/DataTemplate&gt;
      &lt;/ItemsControl.ItemTemplate&gt;
  &lt;/ItemsControl&gt;
  </code></pre>
  
  <p>And then, I change the <code>Source</code> of ths WebView, and hide/make them visible using the ViewModel:</p>
  
  <pre><code>public class WebviewViewModel : INotifyPropertyChanged
  {
      public event PropertyChangedEventHandler PropertyChanged;
  
      public Guid LinkedId { get; set; }
  
      private System.Windows.Visibility _visibility;
      public Visibility Visibility
      {
          get
          {
              return _visibility;
          }
  
          set
          {
              _visibility = value;
              PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Visibility)));
          }
      }
  
      private Uri _source;
      public Uri Source
      {
          get
          {
              return _source;
          }
  
          set
          {
              _source = value;
              PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Source)));
          }
      }
  }
  </code></pre>
  
  <p><code>WebviewsDataSource</code> is <code>ObservableCollection&lt;WebviewViewModel&gt;</code></p>
  
  <p>The whole thing seems to works, but ONLY for the external websites, not for the local one. I always get an <code>404 NotFound</code> for the local network sites when using this ways for creating WebViews, as if <code>IsPrivateNetworkClientServerCapabilityEnabled</code> was ignored. But the local site works with the simple method.</p>
  
  <p>I've checked the states of the WebViews after the creation, and the <code>IsPrivateNetworkClientServerCapabilityEnabled</code> value is still to <code>true</code>.</p>
  
  <p><strong>So...</strong></p>
  
  <p>Since this control is <a href="https://blogs.windows.com/msedgedev/2018/05/09/modern-webview-winforms-wpf-apps/" rel="nofollow noreferrer">relatively new</a>, this looks like a bug to me...
  But am i doing something wrong?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Minimal <code>.sln</code> of the problem can be downloaded <a href="https://github.com/Microsoft/WindowsCommunityToolkit/files/2261631/WebViewBugReport.zip" rel="nofollow noreferrer">here</a>.</p>
  
  <p>This simple WPF application will fail to open local network website in <code>ItemTemplate</code> (while external site will works), and will succeed to open local network websites when using the control directly.</p>
  
  <p>Just change the <code>WebviewsDataSource</code> value in <code>MainWindowViewModel.cs</code> to test local network urls.</p>