Exemple #1
0
        /// <summary>
        /// Processes the control tree.
        /// </summary>
        private void ProcessControlTreeCore(DotvvmBindableObject control, Action <DotvvmBindableObject> action)
        {
            // if there is a DataContext binding, locate the correct token
            var hasDataContext = false;
            var pathValue      = control.GetDataContextPathFragment();

            if (pathValue != null)
            {
                CurrentPath.Push(pathValue as string);
                RefreshCurrentPathArray();
                hasDataContext = true;
            }

            action(control);

            // go through all children
            foreach (var child in control.GetLogicalChildren())
            {
                ProcessControlTreeCore(child, action);
            }

            if (hasDataContext)
            {
                CurrentPath.Pop();
                RefreshCurrentPathArray();
            }
        }
Exemple #2
0
        /// <summary>
        /// Processes the control tree.
        /// </summary>
        private void ProcessControlTreeCore(DotvvmBindableObject control, Action<DotvvmBindableObject> action)
        {
            // if there is a DataContext binding, locate the correct token
            var hasDataContext = false;
            var pathValue = control.GetValue(Internal.PathFragmentProperty, false);
            if (pathValue != null)
            {
                CurrentPath.Push(pathValue as string);
                RefreshCurrentPathArray();
                hasDataContext = true;
            }
            else
            {
                var binding = control.GetValueBinding(DotvvmBindableObject.DataContextProperty, false);
                if (binding != null)
                {
                    CurrentPath.Push(binding.GetKnockoutBindingExpression());
                    RefreshCurrentPathArray();
                    hasDataContext = true;
                }
            }

            action(control);

            // go through all children
            foreach (var child in control.GetLogicalChildren())
            {
                ProcessControlTreeCore(child, action);
            }

            if (hasDataContext)
            {
                CurrentPath.Pop();
                RefreshCurrentPathArray();
            }
        }