Hi, I'm trying to add a TemplateField programmatically in C#, but I cannot seem to get the binding correctly. How can I reference TemplateEditorValueBinding correctly?
var text = new FrameworkElementFactory(typeof(TextBlock)); text.SetBinding(TextBox.TextProperty, new Binding { Path = new PropertyPath("{editors:TemplateEditorValueBinding}")}); var dtDisplay = new DataTemplate {VisualTree = text}; field.DisplayTemplate = dtDisplay;
Thank you
Hello Patrick,
Thank you for contacting. Your binding should be like this.
<TextBlock Text="{Binding Path=(igEditors:TemplateEditor.Editor).Value, RelativeSource={RelativeSource Self}}" HorizontalAlignment="Right"/>
For more information refer to this online help document.
Let me know if you have any question.
How do you construct that in C# (code-behind)?