Skip to content

chore: use uen nav.data to send data with tab navigation #881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UI/Navigation/src/Navigation/Models/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public Entity(string name)
{
Name = name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
VerticalAlignment="Bottom"
uen:Region.Attached="True">
<utu:TabBar.Items>
<utu:TabBarItem Command="{Binding GoToFirstTabCommand}"
<utu:TabBarItem uen:Region.Name="TBDataOne"
uen:Navigation.Data="{Binding Entity}"
Content="One" />
<utu:TabBarItem Command="{Binding GoToSecondTabCommand}"
<utu:TabBarItem uen:Region.Name="TBDataTwo"
uen:Navigation.Data="{Binding Entity}"
Content="Two" />
</utu:TabBar.Items>
</utu:TabBar>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Navigation.Presentation;
namespace Navigation.Presentation;

public partial class TabBarWithDataViewModel
{
Expand All @@ -9,22 +9,7 @@ public TabBarWithDataViewModel(INavigator navigator)
_navigator = navigator;

Entity = new("TabBar Entity");

Initialize();
}

public Entity Entity { get; set; }

private async void Initialize()
{
await GoToFirstTab();
}

[RelayCommand]
private async Task GoToFirstTab()
=> await _navigator.NavigateRouteAsync(this, route: "TBDataOne", Qualifiers.Nested, data: Entity);

[RelayCommand]
private async Task GoToSecondTab()
=> await _navigator.NavigateRouteAsync(this, route: "TBDataTwo", qualifier: Qualifiers.Nested, data: Entity);
}
Loading