title: WPF binding Dictionary<string, List<string> to listView, ListBox how?
body: <p>how to bind Dictionary to ListView and Text box?</p>
  
  <pre><code>namespace Models
  {
    public class DynamicList
    {
      #region Constructor
  
      public DynamicList()
      {
          _propDict = new Dictionary&lt;string, object&gt;();
          dynimicListProps = new List&lt;DynimicListProperty&gt;();
      }
      #endregion Constructor
  
      #region Fields
  
      private Dictionary&lt;string, object&gt; _propDict;
      private IList&lt;DynimicListProperty&gt; dynimicListProps;
      #endregion Fields
  
      #region Properties
      public Dictionary&lt;string, object&gt; PropsDict
      {
          get { return _propDict; }
          set { _propDict = value; }
      }
      public string TestString
      {
          get { return "Hello! It's works!"; }
      }
      #endregion Properties
  
      #region Methods
      public void CreateProperties(string[] arrLine)
      {
          for (int i = 0; i &lt; arrLine.Count(); i++)
          {
              _propDict.Add(arrLine[i].Replace("\"",""), null);
          }
      }
  
      #endregion Methods
    }
  
    public class DynimicListProperty
    {
      private IList&lt;string&gt; propertyNameValues = new List&lt;string&gt;();
  
      public IList&lt;string&gt; PropertyNameValues
      {
          get { return propertyNameValues; }
          set { propertyNameValues = value; }
      }
    }
  }
  
  // now try to bind
  
  private Models.DynamicList _dynimicList;
  public Models.DynamicList _DynimicList
          {
              get { return _dynimicList; }
          }
  CreateView()
  {
      _importView = new Views.ImportBomView();
                  _importView.Grid1.DataContext = _DynimicList;
                  Binding bn = new Binding("Value.[2]");
                  bn.Mode = BindingMode.OneWay;
                  bn.Source = _DynimicList.PropsDict.Keys;
                  _importView.tbFileName.SetBinding(TextBlock.TextProperty, bn);
    /////////////////////////////////////////////////////////////////////////////         
   //_importView.listView1.ItemsSource = (IEnumerable)_DynimicList.PropsDict["Value"];
   ////// it's works when Binding bn2 = new Binding("") but of course in 
   ///this emplementation I have the same data in all columns - so not good
   /////////////////////////////////////////////////////////////////////////////////////
  
             // here I'll like to generate Columns and bind gvc.DisplayMemberBinding
             // to dictionary _DynimicList.PropsDict[item] with Key=item
             foreach (var item in _DynimicList.PropsDict.Keys)
              {
                  Binding bn2 = new Binding("[3]");
                  bn2.Source = (IEnumerable)_DynimicList.PropsDict[item];
                  GridViewColumn gvc = new GridViewColumn();
                  gvc.DisplayMemberBinding = bn2;
                  gvc.Header = item;
                  gvc.Width = 100;
                  _importView.gridView1.Columns.Add(gvc);
              }
              _importView.Show();
          }
  
  }
  </code></pre>