I created an Enum type:
internal enum Routes
{
PageOne,
PageTwo,
}
In AppShell, I navigate from MainPage to another ShellContent (PageOne) using a button:
<ShellContent
Title="Home"
ContentTemplate="{DataTemplate local:MainPage}" />
<TabBar>
<Tab>
<ShellContent
Title="PageOne"
Route="PageOne"
ContentTemplate="{DataTemplate local:PageOne}" />
</Tab>
</TabBar>
So far everything works fine until I start doing this:
<TabBar>
<Tab>
<ShellContent
Title="PageOne"
Route="{Binding Source={x:Static local:Routes.PageOne}}"
ContentTemplate="{DataTemplate local:PageOne}" />
</Tab>
</TabBar>
The compiler throws the following error:
XamlC error XFC0009: No property, BindableProperty, or event found for “Route“, or mismatching type between value and property.
What is puzzling me is that even though both the Title and Route properties are of type string, the Title property accepts the enum value just fine while the Route property doesn’t. For example, the following block works as expected:
<ShellContent
Title="{Binding Source={x:Static local:Routes.PageOne}}"
Route="PageOne" />
Why the enum value is not binding correctly to the Route property? And is there a workaround?