Element binding issue

Feb 18, 2013 at 9:06 AM
Hi All,

I have the following code:
<Grid Name="MainGrid">
    <w:Wizard Name="MyWizard" w:Designer.PageIndex="1" DataContext="{Binding ElementName=MainGrid, Path=DataContext.Policy}" >
        <w:WizardPage Header="Main Member" MaxHeight="600" AllowNext="{Binding ElementName=MainGrid, Path=DataContext.CanContinue}" Name="MainPage">
        </w:WizardPage>
        <w:WizardPage Name="DeductionPage" Header="Policy Details" AllowBack="False" AllowNext="{Binding ElementName=MainGrid, Path=DataContext.CanContinue}">
        </w:WizardPage>
    </w:Wizard>
</Grid>
On the first page the AllowNext binding works fine but on the second page I receive the following error:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=MainGrid'. BindingExpression:Path=DataContext.CanContinue; DataItem=null; target element is 'WizardPage' (Name='DeductionPage'); target property is 'AllowNext' (type 'Boolean')
Does anybody know how this might be caused?