示例#1
0
 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;
 }
        /// <summary>
        /// Associate the value of the text field with a property
        /// specified by the derived class. Called one per class type.
        /// </summary>
        /// <param name="shapeFields">ShapeFieldCollection to initialized</param>
        protected override void InitializeShapeFields(IList <ShapeField> shapeFields)
        {
            Store             store     = Store;
            AutoSizeTextField textField = CreateAutoSizeTextField("TextField");

            textField.AssociateValueWith(Store, AssociatedModelDomainPropertyId);
            textField.DefaultFocusable = true;
            shapeFields.Add(textField);

            // Adjust anchoring after all shape fields are added
            AnchoringBehavior anchor = textField.AnchoringBehavior;

            anchor.CenterHorizontally();
            anchor.CenterVertically();

            Debug.Assert(TextShapeField == null);             // This should only be called once per type
            TextShapeField = textField;
        }