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); } } }
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; } }
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; } }