Matt, It doesn’t have to be a Dependency Property if your DataContext
implements INotifyPropertyChanged and fires the event on a change.
From: Matt Hamilton
Sent: Friday, October 29, 2010 10:42 AM
To: ozWPF
Subject: Re: Dialog OK/Cancel binding
Yeah, you could just make a bool property on the Window itself and bind to it.
One way to do that would be to give your dialog window a name:
<Window ... x:Name=”me”>
and then bind to the property from the button back to its own window:
<Button IsEnabled=”{Binding CanSubmit,ElementName=me}”>OK</Button>
You would have to make your “CanSubmit” property a DependencyProperty though,
so that WPF knew to update the binding when the value changed.
Matt
From: Greg Keogh
Sent: Friday, October 29, 2010 10:31 AM
To: 'ozWPF'
Subject: RE: Dialog OK/Cancel binding
I think this would do it - <Button IsEnabled={Binding
WhateverBooleanProperty}”/> as long as the DataContext is set on the Button or
any of its descendants.
But what is the DataContext? The parent Window? I have to set the Source or
RelativeSource to something, the Window with the bool property? What’s the
syntax for that?
Damn binding syntax.
Greg
--------------------------------------------------------------------------------
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
--------------------------------------------------------------------------------
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf