title: WPF binding GridView with class properties?
body: <p>I am new to WPF.</p>
  
  <p>A class property that has array of names (reading from appconfig)</p>
  
  <pre><code>class Sample
  {
      private string[] names; 
      public string[] Names
      {
          get
          {
          names = ConfigurationManager.AppSettings["UserNames"].Split(',');
              return machines;
          }
          set { names = value; }
      }
  }
  </code></pre>
  
  <p>I want to populate a WPF Gridview with these names.</p>
  
  <p>Here is my NamesView.xaml:</p>
  
  <pre><code> &lt;ListView&gt;
          &lt;ListView.View&gt;
              &lt;GridView AllowsColumnReorder="True" &gt;
                  &lt;GridViewColumn Header="Names" Width="auto" DisplayMemberBinding="{Binding Path=Names}"/&gt;
              &lt;/GridView&gt;
          &lt;/ListView.View&gt;
   &lt;/ListView&gt;
  </code></pre>
  
  <p>Here is my code behind NamesView.xaml.cs:</p>
  
  <pre><code>public partial class ServerView : Windows
  {
      public ServerView()
      {
          InitializeComponent();
          Sample sample = new Sample();
          this.DataContext = sample.Names;
      }
  }
  </code></pre>
  
  <p>Question: </p>
  
  <p>Not able to understand what is mistake? If any site or stuff is there to study, please share?</p>
  
  <p>[Solved]</p>
  
  <p>Actually for grid view <code>DataContext</code> is not working, I used <code>Itemssource</code> and it worked.</p>