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
295
MaxLines in XamTextEditor
posted

In the XamDataGrid i have a Field which is of DataType XamTextEditor, this field is set a value Wrap for property TextWrapping, so the text in that field is wrapped to 3-4 lines but my requirement is to display only the first two lines. How can i have achieve this?

Thanks in Advance

 

 

  • 54937
    Suggested Answer
    Offline posted

    In WPF, the TextBlock class does not have a notion of min/max lines; that is only available on the TextBox. For effeciency, the xamTextEditor uses a TextBlock when not in edit mode and only uses a TextBox while it is in edit mode so the xamTextEditor does not try to expose (Min|Max)Lines. If you need this while in edit mode and not in edit mode then you might try retemplating the xamTextEditor such that it contains a textbox while in edit mode and not in edit mode. You can use the default xaml we ship with the product (included in the DefaultStyles directory) as a starting point for your custom template. Note, you'll probably want to set the IsReadOnly and Focusable properties of the textbox to false while not in edit mode since the editing should only be allowed while in edit mode.