如何使用c#代码编写以下xaml?
<DataGridTextColumn
Header="{Binding (FrameworkElement.DataContext).NamedRankTypeHelper.NamedRankTypeList,
RelativeSource={x:Static RelativeSource.Self},
Converter={StaticResource GridHeaderListeToHeaderValueConv},
ConverterParameter=1,
FallbackValue=Filter1}" IsReadOnly="true">
<DataGridTextColumn.Binding>
<Binding Path="Programm" ValidatesOnDataErrors="True">
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
我试过这个,但我的问题是(FrameworkElement.DataContext)
for (int i = 1; i <= maxRank; i++)
{
this.GridDruckUndVersand.Columns.Insert(i + start,
new DataGridTextColumn()
{
//dont know how i can put in (FrameworkElement.DataContext)
Header = new Binding("(FrameworkElement.DataContext).NamedRankTypeHelper.NamedRankTypeList")
{
RelativeSource = new RelativeSource(RelativeSourceMode.Self),
Converter = new NamedRankTypeToGridFilterHeaderConverter(),
ConverterParameter = i.ToString(),
FallbackValue = "Filter "+ i.ToString()
},
IsReadOnly = true,
Binding = new Binding("FilterItems[" + i + "]")
});
}
答案 0 :(得分:0)
我不确定FrameworkElement.DataContext周围的()是什么,但你错过了C#版本中的open。(