0

C# で列を動的に構築しようとしていますが、これを C# に変換する方法がわかりません

<xcdg:Column FieldName="Name" 
             Title="Name"
             DisplayMemberBinding="{Binding}"
             CellContentTemplate="{StaticResource InputManagerNameCellTemplate}"
             AllowAutoFilter="False"/>

そのすべてを変換する方法を知っていますが、DisplayMemberBinding 部分です。

ありがとう。

4

1 に答える 1

2

これを試して:

new Binding()
{
    Path = new PropertyPath(FrameworkElement.DataContextProperty),
    RelativeSource = new RelativeSource(RelativeSourceMode.Self)
}

XAML の Empty Binding は、同じ要素で DataContext にバインドするためのショートカットです。

于 2012-04-24T18:36:14.450 に答える