Beispiel #1
0
        /// <summary>
        /// Tries to set the keyboard focus (cursor) to the first content field
        /// </summary>
        public void ContentFocus()
        {
            // need data context of the UC coming from Submodel, SMEC or at least listOfElements
            var dc = IndividualDataContext.CreateDataContext(this.DataContext);

            if (dc == null || StackPanelElements == null)
            {
                return;
            }

            FormInstanceListOfDifferent lod = null;

            if (dc.smInst != null)
            {
                lod = dc.smInst.PairInstances;
            }
            if (dc.smecInst != null)
            {
                lod = dc.smecInst.PairInstances;
            }
            if (lod != null && lod.Count > 0 && lod[0].instances != null &&
                lod[0].instances.SubInstances != null && lod[0].instances.SubInstances.Count > 0)
            {
                var sc00 = lod[0].instances.SubInstances[0].subControl;
                if (sc00 != null && sc00 is IFormListControl)
                {
                    (sc00 as IFormListControl).ContentFocus();
                }
            }
        }
Beispiel #2
0
        // External interfaces

        /// <summary>
        /// Set the property, given by enum <c>IFormListControlPropertyType</c> to the
        /// value
        /// </summary>
        public void SetProperty(IFormListControlPropertyType property, object value)
        {
            // need data context of the UC coming from Submodel, SMEC or at least listOfElements
            var dc = IndividualDataContext.CreateDataContext(this.DataContext);

            if (dc == null || StackPanelElements == null)
            {
                return;
            }

            // own properties?
            if (property == IFormListControlPropertyType.FormSmaller && value is bool &&
                TextBlockHeaderFormInfo != null)
            {
                TextBlockHeaderFormInfo.Visibility = (bool)value ? Visibility.Visible : Visibility.Collapsed;
            }

            // pass on
            FormInstanceListOfDifferent lod = null;

            if (dc.smInst != null)
            {
                lod = dc.smInst.PairInstances;
            }
            if (dc.smecInst != null)
            {
                lod = dc.smecInst.PairInstances;
            }
            if (lod != null && lod.Count > 0)
            {
                foreach (var ld in lod)
                {
                    if (ld.instances != null && ld.instances.subControl != null &&
                        ld.instances.subControl is FormListOfSameControl flsc)
                    {
                        flsc.SetProperty(property, value);
                    }
                }
            }
        }