I am trying to solve a complicated problem. I am building a dynamic interface and want to convert any existence of an ArrayList
into a TreeView
. I tried value converter but it did not work.
Here is my code:
if(current.Value is ArrayList)
{
var factory = new FrameworkElementFactory(typeof (TreeView));
factory.SetBinding(TreeView.ItemsSourceProperty, new Binding("[" + current.Key + "]"));
factory.SetBinding(TreeView.DisplayMemberPathProperty, new Binding("[" + current.Key + "][0].Text"));
template = new DataTemplate() {VisualTree = factory};
}
var column = new GridViewColumn
{
Header = current.Key,
CellTemplate = template
};
gridView.Columns.Add(column);
The ArrayList
has items that are Dictionary<String,Object>
and then the dictionary has items.