How i can add column in wpf toolkit datagrid 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.