There are two pages: MainPage and AddQuotePage
MainPage.xaml, located in the project root folder has a Frame
that loads AddQuotePage.xaml which is located in the Views folder.
MainPage contains the titlebar as a RelativePanel
and a SplitView
for displaying the hamburger menu and the content in a Frame
.
MainPage works like a shell that loads in its Frame
different app
MainPage has a List<Icon> CategoryIcons
property.
AddQuotePage contains a GridView
for which I want to set ItemsSource="{Binding MainPage.CategoryIcons}"
and set an ItemTemplate like this
<GridView ItemsSource="{Binding MainPage.CategoryIcons}">
<GridView.ItemTemplate>
<DataTemplate x:DataType="data:Icon">
<BitmapIcon UriSource="{x:Bind Uri}" />
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
This does not work. In WPF you would have {Binding Path=PathToProperty, RelativeSource={RelativeSource AncestorType={x:Type typeOfAncestor}}}
but this doesn't exist in UWP or at least I didn't find it.
How do I reference the property from MainPage so that data binding is valid?