Really annoying issue. The code seems to work fine, but when run, I see this error being thrown up:
System.Windows.Data Error: 40 : BindingExpression path error: 'IsOpen' property not found on 'object' ''MainViewModel' (HashCode=33664731)'. BindingExpression:Path=IsOpen; DataItem='MainViewModel' (HashCode=33664731); target element is 'Popup' (Name='LoginPopup'); target property is 'IsOpen' (type 'Boolean')
I understand there is some sort of issue where IsOpen property of LoginPopup binding is being attempted on the MainViewModel and failing because there is no IsOpen property in the MainViewModel. Fine and good, but the DataContext I'm binding to is not the mainviewmodel, but the LoginPopupViewModel (LoginPopup in the ViewModelLocator class). Intellisense seems to agree with me that things are bound to the LoginPopupViewModel, as if I type other things in the Binding portion of IsOpen, it complains that, "Cannot resolve property in data context of LoginPopupViewModel", as it should.
Here's a portion of the XAML code:
<Popup x:Name="LoginPopup" PlacementTarget="{Binding ElementName=LoginButton}"
Placement="Bottom"
HorizontalOffset="-40" VerticalOffset="35" StaysOpen="False"
IsOpen=" {Binding IsOpen}"
DataContext="{Binding LoginPopup, Mode=OneWay, Source={StaticResource Locator}}"
Grid.ColumnSpan="3" Grid.Column="0"
Margin="0,0,0.333,0"
Grid.Row="0" Grid.RowSpan="2">
I'm not exactly a master of WPF, so I'm probably missing something, or the sytax is wrong here. Any help would be fantastic! Thanks!