uno.extensions icon indicating copy to clipboard operation
uno.extensions copied to clipboard

[Navigation] Pass Data when navigating with TabBar and NavigationView

Open erikvilima opened this issue 1 year ago • 0 comments

What would you like to be added:

Be able to pass data to VMs when navigating with TabBar or NavigationView, like:

<Grid uen:Region.Attached="True">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Grid uen:Region.Attached="True"
          uen:Region.Navigator="Visibility" />

    <utu:TabBar Grid.Row="1"
                VerticalAlignment="Bottom"
                uen:Region.Attached="True">
        <utu:TabBar.Items>
            <utu:TabBarItem uen:Region.Name="TbOne"
                            uen:Navigation.Data="{Binding Entity}"
                            Content="One" />
            <utu:TabBarItem uen:Region.Name="TbTwo"
                            uen:Navigation.Data="{Binding Entity}"
                            Content="Two" />
        </utu:TabBar.Items>
    </utu:TabBar>
</Grid>

Why is this needed:

To be able to send data across VMs using only XAML, currently it's needed to define a command in C# to do:

await _navigator.NavigateRouteAsync(this, route: "./TbOne", data: Entity);

For which Platform:

  • [ ] iOS
  • [ ] Android
  • [ ] WebAssembly
  • [ ] WebAssembly renders for Xamarin.Forms
  • [ ] Windows
  • [ ] Build tasks

Anything else we need to know?

erikvilima avatar Jul 19 '24 13:07 erikvilima