如何使用绑定创建运行时ListView?wpf

如何使用绑定创建运行时ListView?wpf,listview,binding,datatemplate,gridviewcolumn,frameworkelementfactory,Listview,Binding,Datatemplate,Gridviewcolumn,Frameworkelementfactory,例如,我不能从这个代码中得到结果!请帮帮我,tnx.) GridViewColumn gvc6 = new GridViewColumn(); gvc6.DisplayMemberBinding = new Binding("sum"); FrameworkElementFactory txt = new FrameworkElementFactory(typeof(TextBox)); txt.SetBinding(TextBo

例如,我不能从这个代码中得到结果!请帮帮我,tnx.)

        GridViewColumn gvc6 = new GridViewColumn();
        gvc6.DisplayMemberBinding = new Binding("sum");

        FrameworkElementFactory txt = new FrameworkElementFactory(typeof(TextBox));
        txt.SetBinding(TextBox.TextProperty, new Binding()); // sets binding


        gvc6.CellTemplate = new DataTemplate(typeof(string));
        gvc6.CellTemplate.VisualTree = txt;