-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Tried couple additional things in attempt to get some form of …
…navigation to work. Attempted to: - Use Visibility directly without the use of Regions, via bindings. - Tried to use ICommands to trigger change of visibility.
- Loading branch information
Showing
13 changed files
with
309 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 25 additions & 2 deletions
27
Tracker.Frontend.Uno/Presentation/ModulesNavigationViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,43 @@ | ||
using Tracker.Module.Budget.Presentation.ViewModel; | ||
using Uno.Extensions.Equality; | ||
|
||
namespace Tracker.Frontend.Uno.Presentation; | ||
|
||
public partial class ModulesNavigationViewModel : ObservableObject | ||
{ | ||
private readonly INavigator _navigator; | ||
|
||
[ObservableProperty] private TrackerModule.Module activeModule; | ||
|
||
[ObservableProperty] private Visibility budgetModuleVisibility; | ||
[ObservableProperty] private Visibility diningModuleVisibility; | ||
[ObservableProperty] private Visibility timeModuleVisibility; | ||
|
||
public ModulesNavigationViewModel(IOptions<AppConfig> appInfo, INavigator navigator) | ||
{ | ||
_navigator = navigator; | ||
Title = "Tracker"; | ||
|
||
//GoToSecond = new AsyncRelayCommand(GoToSecondView); | ||
SetActiveModule(ModulesNavigationPage.Modules[0].TypeModule); | ||
} | ||
|
||
public string? Title { get; } | ||
|
||
//public ICommand GoToSecond { get; } | ||
public void ListViewOnSelectionChanged(object sender, SelectionChangedEventArgs e) | ||
{ | ||
var listView = (ListView) sender; | ||
TrackerModule trackerModule = ModulesNavigationPage.Modules[listView.SelectedIndex]; | ||
|
||
SetActiveModule(trackerModule.TypeModule); | ||
} | ||
|
||
private void SetActiveModule(TrackerModule.Module module) | ||
{ | ||
ActiveModule = module; | ||
BudgetModuleVisibility = | ||
ActiveModule == TrackerModule.Module.BUDGET ? Visibility.Visible : Visibility.Collapsed; | ||
DiningModuleVisibility = | ||
ActiveModule == TrackerModule.Module.DINING ? Visibility.Visible : Visibility.Collapsed; | ||
TimeModuleVisibility = ActiveModule == TrackerModule.Module.TIME ? Visibility.Visible : Visibility.Collapsed; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using Microsoft.UI; | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Input; | ||
using Microsoft.UI.Xaml.Media; | ||
using Tracker.Module.Dining.Presentation.ViewModel; | ||
|
||
namespace Tracker.Module.Dining.Presentation; | ||
|
||
public sealed partial class DiningTabs : UserControl | ||
{ | ||
public const string TAB_REGION_NAME_ONE = "DiningTabOne"; | ||
|
||
public DiningTabs() | ||
{ | ||
this.DataContext<DiningTabsViewModel>((userControl, vm) => | ||
userControl.TabNavigation(KeyboardNavigationMode.Cycle).Background(Theme.Brushes.Background.Default) | ||
.Content(BuildContent(vm))); | ||
} | ||
|
||
private Grid BuildContent(DiningTabsViewModel viewModel) | ||
{ | ||
var grid = new Grid(); | ||
|
||
grid.SafeArea(SafeArea.InsetMask.VisibleBounds); | ||
grid.RowDefinitions(new GridLength(8, GridUnitType.Star), new GridLength(92, GridUnitType.Star)); | ||
|
||
TabBar tabBar = BuildTabBar(viewModel).Grid(row: 0); | ||
Grid contentGrid = BuildContentGrid(viewModel).Grid(row: 1); | ||
|
||
grid.Children.Add(tabBar); | ||
grid.Children.Add(contentGrid); | ||
|
||
return grid; | ||
} | ||
|
||
private TabBar BuildTabBar(DiningTabsViewModel viewModel) | ||
{ | ||
var tabBarItems = new TabBarItem[] | ||
{ | ||
new() {Content = TAB_REGION_NAME_ONE,}, | ||
}; | ||
|
||
var tabBar = new TabBar | ||
{ | ||
VerticalAlignment = VerticalAlignment.Top, | ||
ItemsSource = tabBarItems, | ||
Background = new SolidColorBrush(Colors.DarkGray), | ||
}; | ||
|
||
return tabBar; | ||
} | ||
|
||
private Grid BuildContentGrid(DiningTabsViewModel viewModel) | ||
{ | ||
var grid = new Grid(); | ||
|
||
var tabOne = new Grid() {Visibility = Visibility.Collapsed,}; | ||
//tabOne.Children.Add(new PaymentsTab()); | ||
|
||
grid.Children.Add(tabOne); | ||
|
||
return grid; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
Tracker.Module.Dining.Presentation/Tracker.Module.Dining.Presentation.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="ViewModel\" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="CommunityToolkit.Mvvm" /> | ||
<PackageReference Include="Uno.Themes.WinUI.Markup" /> | ||
<PackageReference Include="Uno.Toolkit.WinUI.Markup" /> | ||
<PackageReference Include="Uno.WinUI" /> | ||
</ItemGroup> | ||
|
||
</Project> |
7 changes: 7 additions & 0 deletions
7
Tracker.Module.Dining.Presentation/ViewModel/DiningTabsViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
|
||
namespace Tracker.Module.Dining.Presentation.ViewModel; | ||
|
||
public partial class DiningTabsViewModel : ObservableObject | ||
{ | ||
} |
Oops, something went wrong.