No problemo Matt, as you say it can be done either way, however, I personally tend to prefer the use of INOtifyPropertyChanged for simple applications like this and DPs if things need to be animated etc. So in this case I would have no hesitance in adding the MyWindow : Window, INotifyPropertyChanged and adding the event to my Window.
I haven’t done a strict analysis on it but I figure there’s more overhead (cycles etc) used by the DP framework. That said, I have been know to be guilty of premature optimisation at times From: Matt Hamilton Sent: Friday, October 29, 2010 11:01 AM To: ozWPF Subject: Re: Dialog OK/Cancel binding Sure, but in this case the DataContext is the Window itself, which is a DependencyObject. It made more sense to suggest implementing the property as a dependency property than implementing INotifyPropertyChanged on the window. From: [email protected] Sent: Friday, October 29, 2010 10:58 AM To: ozWPF Subject: Re: Dialog OK/Cancel binding 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 -------------------------------------------------------------------------------- _______________________________________________ ozwpf mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
<<wlEmoticon-winkingsmile[1].png>>
_______________________________________________ ozwpf mailing list [email protected] http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
