Click here to Skip to main content
15,889,863 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a class that inherits from TextField that is intended to wrap the text across multiple lines.
I replace the standard TextField with it :-

C#
protected override void InitializeShapeFields(IList<ShapeField> shapeFields)
{
    base.InitializeShapeFields(shapeFields);
    // Find the Comments decorator and make it wrapped
    TextField commentField = FindShapeField(shapeFields, FIELDNAME_DESCRIPTION) as TextField;
    shapeFields.Remove(commentField);
    // Replace with wrapped text field
    UI.Decorators.WrappedTextField   wrappedCommentField = new UI.Decorators.WrappedTextField(commentField);
    shapeFields.Add(wrappedCommentField);
}


But no wrapping occurs?

The code for WrappedTextField is:
C#
public class WrappedTextField: TextField
{

    public WrappedTextField(TextField prototype)
        : base(prototype.Name )
    {
        // Copy the starting properties form the prototype
        DefaultText = prototype.DefaultText;
        DefaultFocusable = prototype.DefaultFocusable;
        DefaultAutoSize = false;
        DefaultMultipleLine = true;
        AnchoringBehavior.Clear();
        AnchoringBehavior.CenterHorizontally(  );
        AnchoringBehavior.CenterVertically(  );
        DefaultAccessibleState = prototype.DefaultAccessibleState;

    }

}
Posted
Comments
gggustafson 13-Jun-15 11:43am    
MSDN documentation states "[TextField] Renders a field on a form page (not a list view page) as a single-line text box....For multiline text box rendering, see NoteField."
Duncan Edwards Jones 13-Jun-15 17:51pm    
Ah - I meant Modelling.Diagrams.TextField - https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.modeling.diagrams.textfield.aspx - there doesn't seem to be a NoteField equivalent.
gggustafson 15-Jun-15 11:28am    
Sorry missed that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900