I'm trying to bind my whole window to a underlying usercontrol to let that usercontrol control parent window behaviour. For example i would like to close the parent window from the userControl. I want to create a custom TitleBar that i can reuse in other windows. I have tried using
<views:TitlebarUserCtrl BoundWindow="{Binding ElementName=Window1, Mode=OneWay}" ></views:TitlebarUserCtrl>
.
public static readonly DependencyProperty BoundCurrentWindow = DependencyProperty.Register("BoundWindow", typeof(Window), typeof(TitlebarUserCtrl), new UIPropertyMetadata(""));
public Window BoundWindow
{
get
{
return (Window)GetValue(BoundCurrentWindow);
}
set
{
SetValue(BoundCurrentWindow, value);
}
}
But i only get a error. Any suggestions?