I have a grid whose width is \"1*\". So the actual width decided at runtime I think. Within that grid I have another grid whose width I want to set to the runtime width of paren
If you are doing it in CodeBehind, this works for me. It has the added advantage that bindMe does not have to be a child of toMe:
public static void BindWidth(this FrameworkElement bindMe, FrameworkElement toMe)
{
Binding b = new Binding();
b.Mode = BindingMode.OneWay;
b.Source = toMe.ActualWidth;
bindMe.SetBinding(FrameworkElement.WidthProperty, b);
}
usage:
child.BindWidth(parent);