Better shell
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<abstract:ContactsAppShellAbstract
|
||||
x:Class="Wino.Mail.WinUI.Views.Contacts.ContactsAppShell"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:abstract="using:Wino.Mail.WinUI.Views.Abstract"
|
||||
xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls">
|
||||
|
||||
<Grid x:Name="RootGrid" Padding="0" ColumnSpacing="0" RowSpacing="0">
|
||||
<muxc:NavigationView
|
||||
x:Name="navigationView"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="-1,-1,0,0"
|
||||
Style="{StaticResource CalendarShellNavigationViewStyle}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
AlwaysShowHeader="True"
|
||||
DisplayModeChanged="NavigationViewDisplayModeChanged"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsPaneOpen="{x:Bind PreferencesService.IsNavigationPaneOpened, Mode=TwoWay}"
|
||||
IsPaneToggleButtonVisible="False"
|
||||
IsSettingsVisible="False"
|
||||
IsTabStop="True"
|
||||
IsTitleBarAutoPaddingEnabled="False"
|
||||
OpenPaneLength="{x:Bind StatePersistenceService.OpenPaneLength, Mode=TwoWay}"
|
||||
PaneDisplayMode="Auto"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Hidden">
|
||||
<Grid>
|
||||
<Frame
|
||||
x:Name="InnerShellFrame"
|
||||
Padding="0,0,7,7"
|
||||
IsNavigationStackEnabled="False" />
|
||||
|
||||
<coreControls:WinoInfoBar
|
||||
x:Name="ShellInfoBar"
|
||||
MaxWidth="700"
|
||||
Margin="0,60,25,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
IsClosable="False"
|
||||
IsOpen="False" />
|
||||
</Grid>
|
||||
</muxc:NavigationView>
|
||||
</Grid>
|
||||
</abstract:ContactsAppShellAbstract>
|
||||
@@ -0,0 +1,38 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.Navigation;
|
||||
|
||||
namespace Wino.Mail.WinUI.Views.Contacts;
|
||||
|
||||
public sealed partial class ContactsAppShell : Views.Abstract.ContactsAppShellAbstract
|
||||
{
|
||||
public IPreferencesService PreferencesService { get; } = WinoApplication.Current.Services.GetRequiredService<IPreferencesService>();
|
||||
public IStatePersistanceService StatePersistenceService { get; } = WinoApplication.Current.Services.GetRequiredService<IStatePersistanceService>();
|
||||
public INavigationService NavigationService { get; } = WinoApplication.Current.Services.GetRequiredService<INavigationService>();
|
||||
|
||||
public ContactsAppShell()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
if (e.NavigationMode == Microsoft.UI.Xaml.Navigation.NavigationMode.New && InnerShellFrame.Content == null)
|
||||
{
|
||||
NavigationService.Navigate(WinoPage.ContactsPage, null, NavigationReferenceFrame.InnerShellFrame, NavigationTransitionType.None);
|
||||
}
|
||||
}
|
||||
|
||||
private void NavigationViewDisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args)
|
||||
{
|
||||
InnerShellFrame.Margin = args.DisplayMode == NavigationViewDisplayMode.Minimal
|
||||
? new Thickness(7, 0, 0, 0)
|
||||
: new Thickness(0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user