How do I wrap text in a visual studio modelling diagram shape?
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 :-
Code:
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:
Code:
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;
}
}
Many thanks
Duncan