WPF add datagrid image column possible?

前端 未结 4 1074
抹茶落季
抹茶落季 2020-12-17 18:38

Using C#.Net 4.5, Visual Studio 2012 Ulti, WPF.

I\'ve got some old win-forms code that i wanted to do in this new WPF app.

code is the following:

<         


        
4条回答
  •  旧巷少年郎
    2020-12-17 19:19

    See this answer:

    Image Column in WPF DataGrid

     
       
          
               
          
        
     
    

    To add a column in code after:

    DataGridTextColumn textColumn1 = new DataGridTextColumn();
    textColumn1.Header = "Your header";
    textColumn1.Binding = new Binding("YourBindingField");
    dg.Columns.Add(textColumn1);
    

    Use DataGridTemplateColumn to add a custom column See: How do I show image in wpf datagrid column programmatically?

提交回复
热议问题