I have pages with their view models. A Pageshifts to Frameusing Frame.NavigationManager.Navigate().
In one PageI have GroupBoxwith a child DataGrid. I want to GroupBoxchange it Visibilityaccording to the number of elements in DataGrid.
Here is what I have:
<GroupBox ....
Visibility="{Binding ElementName=SomeDataGrid,
Path=HasItems,
Converter={StaticResource BooleanToVisibilityConverter}}">
<DataGrid x:Name="SomeDataGrid"
IsReadOnly="True"
ItemsSource="{Binding Items}"/>
</GroupBox>
Problem
After changing Pageto another and going back, I have the following binding exception
System.Windows.Data error: 4: cannot find source for binding with reference
'ElementName = SomeDataGrid. BindingExpression: Path = HasItems;
I tried using x:Referencebut got the same problem.
Can someone explain what I'm doing wrong?