Binding in a WPF data grid text column

前端 未结 2 1917
萌比男神i
萌比男神i 2020-12-01 10:29

I\'m trying to build a data grid where one of the columns is a font name displayed in that font. Previously, I was working with a list box where I had defined the following

2条回答
  •  青春惊慌失措
    2020-12-01 11:20

    Jared's answer is correct, but I've found a concrete solution that's solved my problem.

    http://blogs.msdn.com/vinsibal/archive/2008/12/17/wpf-datagrid-dynamically-updating-datagridcomboboxcolumn.aspx

    Following this example, I changed my DataGridTextColumn definition to:

    
        
            
        
    
    

    And I don't need to worry about the column inheriting the DataContext. This gives me the result I want.

提交回复
热议问题