How to convert this Xceed XAML to C#
Question
I am trying to dynamically build columns in C#, but I am not sure how to convert this to C#
<xcdg:Column FieldName="Name"
Title="Name"
DisplayMemberBinding="{Binding}"
CellContentTemplate="{StaticResource InputManagerNameCellTemplate}"
AllowAutoFilter="False"/>
I know how to convert all of that BUT the DisplayMemberBinding part.
Thanks.
Solution
Try this:
new Binding()
{
Path = new PropertyPath(FrameworkElement.DataContextProperty),
RelativeSource = new RelativeSource(RelativeSourceMode.Self)
}
Empty Binding in XAML is a shortcut to bind to DataContext on the same element.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow