Merge branch 'main' into shweaver/storage-helpers

This commit is contained in:
Shane Weaver 2021-07-28 10:55:39 -07:00 коммит произвёл GitHub
Родитель b551d43103 cbefac493e
Коммит e65332ba28
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 19 добавлений и 29 удалений

Просмотреть файл

@ -74,19 +74,20 @@
</controls:ListDetailsView.NoSelectionContentTemplate>
<controls:ListDetailsView.ListCommandBar>
<CommandBar>
<!-- Button functionality to be implemented by developer -->
<AppBarButton Icon="Back" Label="Back"/>
<AppBarButton Icon="Forward" Label="Forward"/>
<CommandBar.Content>
<TextBlock Margin="12,14">
<Run Text="{Binding Emails.Count}" />
<Run Text="Items" />
</TextBlock>
</CommandBar.Content>
</CommandBar>
<CommandBar.Content>
<TextBlock Margin="12,14">
<Run Text="{Binding Emails.Count}" />
<Run Text="Items" />
</TextBlock>
</CommandBar.Content>
</CommandBar>
</controls:ListDetailsView.ListCommandBar>
<controls:ListDetailsView.DetailsCommandBar>
<CommandBar>
<!-- Button functionality to be implemented by developer -->
<AppBarButton Icon="MailReply" Label="Reply" />
<AppBarButton Icon="MailReplyAll" Label="Reply All" />
<AppBarButton Icon="MailForward" Label="Forward" />

Просмотреть файл

@ -10,6 +10,7 @@ using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Navigation;
using NavigationView = Microsoft.UI.Xaml.Controls;
namespace Microsoft.Toolkit.Uwp.UI.Controls
{
@ -42,12 +43,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private AppViewBackButtonVisibility? _previousSystemBackButtonVisibility;
private bool _previousNavigationViewBackEnabled;
// Int used because the underlying type is an enum, but we don't have access to the enum
private int _previousNavigationViewBackVisibilty;
private NavigationView.NavigationViewBackButtonVisible _previousNavigationViewBackVisibilty;
private NavigationView.NavigationView _navigationView;
private ContentPresenter _detailsPresenter;
private VisualStateGroup _selectionStateGroup;
private Button _inlineBackButton;
private object _navigationView;
private Frame _frame;
/// <summary>
@ -199,7 +199,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
_frame.Navigating -= OnFrameNavigating;
}
_navigationView = this.FindAscendants().FirstOrDefault(p => p.GetType().FullName == "Microsoft.UI.Xaml.Controls.NavigationView");
_navigationView = this.FindAscendant<NavigationView.NavigationView>();
_frame = this.FindAscendant<Frame>();
if (_frame != null)
{
@ -328,8 +328,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
/// </summary>
private void SetBackButtonVisibility(ListDetailsViewState? previousState = null)
{
const int backButtonVisible = 1;
if (DesignMode.DesignModeEnabled)
{
return;
@ -358,7 +356,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
}
else
{
SetNavigationViewBackButtonState(backButtonVisible, true);
SetNavigationViewBackButtonState(NavigationView.NavigationViewBackButtonVisible.Visible, true);
}
}
else if (BackButtonBehavior != BackButtonBehavior.Manual)
@ -441,27 +439,18 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
VisualStateManager.GoToState(this, SelectedItem == null ? noSelectionState : hasSelectionState, animate);
}
private void SetNavigationViewBackButtonState(int visible, bool enabled)
private void SetNavigationViewBackButtonState(NavigationView.NavigationViewBackButtonVisible visibility, bool enabled)
{
if (_navigationView == null)
{
return;
}
var navType = _navigationView.GetType();
var visibleProperty = navType.GetProperty("IsBackButtonVisible");
if (visibleProperty != null)
{
_previousNavigationViewBackVisibilty = (int)visibleProperty.GetValue(_navigationView);
visibleProperty.SetValue(_navigationView, visible);
}
_previousNavigationViewBackVisibilty = _navigationView.IsBackButtonVisible;
_navigationView.IsBackButtonVisible = visibility;
var enabledProperty = navType.GetProperty("IsBackEnabled");
if (enabledProperty != null)
{
_previousNavigationViewBackEnabled = (bool)enabledProperty.GetValue(_navigationView);
enabledProperty.SetValue(_navigationView, enabled);
}
_previousNavigationViewBackEnabled = _navigationView.IsBackEnabled;
_navigationView.IsBackEnabled = enabled;
}
private void SetDetailsContent()