Binding a string property value to Target property of NavigateTo

Hi,

I’m trying to bind a string property of a button (PageName) to the Target property of NavigateTo action as in the following example:

<App Theme="Basic">
  <ClientPanel ux:Class="PropBindingToNavigateTo">
    <!-- Used for direct nav. Hides inactive pages -->
    <Page ux:Class="dirPage" ux:Name="self">
      <WhileActive Invert="true">
        <Change self.Visibility="Hidden"/>
      </WhileActive>
    </Page>

    <Button ux:InnerClass="MainMenuButton">
      <string ux:Property="PageName" />

      <Clicked>
        <NavigateTo Target="{Property this.PageName}" NavigationContext="Dnav"/>
      </Clicked>
    </Button>

    <DockPanel>
      <Panel>
        <DirectNavigation ux:Name="Dnav" Active="topPage"/>

        <dirPage ux:Name="topPage">
          <Text>Top page</Text>
        </dirPage>

        <dirPage ux:Name="myPage" >
          <Text>My page</Text>
        </dirPage>

        <dirPage ux:Name="favPage">
          <Text>Favourites</Text>
        </dirPage>
      </Panel>

      <Grid Dock="Bottom" ColumnCount="3">
        <MainMenuButton Text="1" PageName="topPage"/>
        <MainMenuButton Text="2" PageName="myPage"/>
        <MainMenuButton Text="3" PageName="favPage"/>
      </Grid>
    </DockPanel>

  </ClientPanel>
<App Theme="Basic">

But I get the following error because of this <NavigateTo Target="{Property this.PageName}" NavigationContext="Dnav"/> line:

System.InvalidOperationException: Sequence contains no elements

I thought since we can make databinding to the Target property of NavigateTo action then we could also make property binding. But right now this syntax doesn’t work or may be my property binding is not correct. Or may be this is a bug or limitation.

And also after this error the local preview crashes and I have to restart it.

Can anyone help me on this issue?

Thanks in advance,

Ipek

Target on NavigateTo does not take a string it takes a Node try:

<Node ux:Property="PageName" />

I knew that it was possible and I was using the wrong syntax! Thanks, it worked.