How to add column in datagrid
How i can add column in wpf toolkit 开发者_如何学JAVAdatagrid from code behind? this does not works:
DataGridTemplateColumn txtc = new DataGridTemplateColumn();
txtc.Header = "2";
myGrid.Columns.Add(txtc);
this is my grid :
<Controls:DataGrid.CellStyle>
<Style TargetType="{x:Type Controls:DataGridCell}">
<Setter Property="Background">
<Setter.Value>
<MultiBinding Converter="{StaticResource myHighlighterConverter}">
<MultiBinding.Bindings>
<Binding RelativeSource="{RelativeSource Self}"></Binding>
<Binding Path="Row"></Binding>
</MultiBinding.Bindings>
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</Controls:DataGrid.CellStyle>
</Controls:DataGrid>
WPF 4 has its own DataGrid, the column you created is from that namespace, it is not compatible with the Toolkit-DataGrid. If you use WPF 4 you probably should not use the Toolkit DataGrid at all.
精彩评论