Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1415
Programmatically adding TemplateEditorValueBinding
posted

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

Parents
No Data
Reply
  • 7555
    Verified Answer
    Offline posted

    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.

Children