Example #1
0
        public static void TransferProperty(this DotvvmControl sourceControl, DotvvmControl targetControl, DotvvmProperty targetProperty,
                                            DotvvmProperty sourceProperty)
        {
            IBinding binding = sourceControl.GetBinding(sourceProperty);

            if (binding != null)
            {
                targetControl.SetBinding(targetProperty, binding);
            }
            else
            {
                var value = sourceProperty.GetValue(sourceControl);
                if (value != null)
                {
                    targetControl.SetValue(targetProperty, value);
                }
            }
        }
Example #2
0
 public static IEnumerable <string> GetContextPath(DotvvmControl control)
 {
     while (control != null)
     {
         var pathFragment = control.GetValue(Internal.PathFragmentProperty, false) as string;
         if (pathFragment != null)
         {
             yield return(pathFragment);
         }
         else
         {
             var dataContextBinding = control.GetBinding(DotvvmBindableObject.DataContextProperty, false) as IValueBinding;
             if (dataContextBinding != null)
             {
                 yield return(dataContextBinding.GetKnockoutBindingExpression());
             }
         }
         control = control.Parent;
     }
 }
Example #3
0
 public static IEnumerable<string> GetContextPath(DotvvmControl control)
 {
     while (control != null)
     {
         var pathFragment = control.GetValue(Internal.PathFragmentProperty, false) as string;
         if (pathFragment != null)
         {
             yield return pathFragment;
         }
         else
         {
             var dataContextBinding = control.GetBinding(DotvvmBindableObject.DataContextProperty, false) as IValueBinding;
             if (dataContextBinding != null)
             {
                 yield return dataContextBinding.GetKnockoutBindingExpression();
             }
         }
         control = control.Parent;
     }
 }