WPF listbox. Skip underscore symbols in strings

前端 未结 4 915
南方客
南方客 2020-12-20 11:19

I have some WPF ListBox which is dynamically populating with items. Something like this :

ListBox.Items.Add
(new ListBoxItem { Content = new CheckBox { IsChe         


        
4条回答
  •  渐次进展
    2020-12-20 11:50

    I had the same problem in a DataGrid. Similarly to AndrewS, I added a style for TextBlock, but did not use DataTemplate or ContentTemplate. This way the setters in ColumnHeaderStyle were applied :) However, this solution works only for single underscores, eg. "a_b", but not for "a__b".

    
        
            
        
    
        
            
        
    
    

提交回复
热议问题