更新整理
This commit is contained in:
@@ -97,7 +97,7 @@ public partial class NavigationView : System.Windows.Controls.Control, INavigati
|
||||
return;
|
||||
}
|
||||
|
||||
_ = NavigateToMenuItemFromAutoSuggestBox(FooterMenuItems, element);
|
||||
NavigateToMenuItemFromAutoSuggestBox(FooterMenuItems, element);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -120,7 +120,7 @@ public partial class NavigationView : System.Windows.Controls.Control, INavigati
|
||||
return;
|
||||
}
|
||||
|
||||
_ = NavigateToMenuItemFromAutoSuggestBox(FooterMenuItems, selectedSuggestBoxItem);
|
||||
NavigateToMenuItemFromAutoSuggestBox(FooterMenuItems, selectedSuggestBoxItem);
|
||||
}
|
||||
|
||||
[DebuggerStepThrough]
|
||||
@@ -231,7 +231,7 @@ public partial class NavigationView : System.Windows.Controls.Control, INavigati
|
||||
protected virtual void AutoSuggestBoxSymbolButtonOnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SetCurrentValue(IsPaneOpenProperty, !IsPaneOpen);
|
||||
_ = AutoSuggestBox?.Focus();
|
||||
AutoSuggestBox?.Focus();
|
||||
}
|
||||
|
||||
protected virtual void BreadcrumbBarOnItemClicked(
|
||||
@@ -239,7 +239,7 @@ public partial class NavigationView : System.Windows.Controls.Control, INavigati
|
||||
BreadcrumbBarItemClickedEventArgs e)
|
||||
{
|
||||
var item = (NavigationViewBreadcrumbItem)e.Item;
|
||||
_ = Navigate(item.PageId);
|
||||
Navigate(item.PageId);
|
||||
}
|
||||
|
||||
protected virtual void CloseNavigationViewItemMenus()
|
||||
@@ -280,9 +280,9 @@ public partial class NavigationView : System.Windows.Controls.Control, INavigati
|
||||
{
|
||||
if(singleNavigationViewItem.Content is string content && content == selectedSuggestBoxItem)
|
||||
{
|
||||
_ = NavigateInternal(singleNavigationViewItem);
|
||||
NavigateInternal(singleNavigationViewItem);
|
||||
singleNavigationViewItem.BringIntoView();
|
||||
_ = singleNavigationViewItem.Focus(); // TODO: Element or content?
|
||||
singleNavigationViewItem.Focus(); // TODO: Element or content?
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ public partial class NavigationView : System.Windows.Controls.Control, INavigati
|
||||
/// <summary>
|
||||
/// This virtual method is called when <see cref="BackButton"/> is clicked.
|
||||
/// </summary>
|
||||
protected virtual void OnBackButtonClick(object sender, RoutedEventArgs e) { _ = GoBack(); }
|
||||
protected virtual void OnBackButtonClick(object sender, RoutedEventArgs e) { GoBack(); }
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OnInitialized(EventArgs e)
|
||||
@@ -327,7 +327,7 @@ public partial class NavigationView : System.Windows.Controls.Control, INavigati
|
||||
// Back button
|
||||
if(e.ChangedButton is MouseButton.XButton1)
|
||||
{
|
||||
_ = GoBack();
|
||||
GoBack();
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ public partial class NavigationView : System.Windows.Controls.Control, INavigati
|
||||
return;
|
||||
}
|
||||
|
||||
_ = VisualStateManager.GoToState(navigationView, navigationView.IsPaneOpen ? "PaneOpen" : "PaneCompact", true);
|
||||
VisualStateManager.GoToState(navigationView, navigationView.IsPaneOpen ? "PaneOpen" : "PaneCompact", true);
|
||||
}
|
||||
|
||||
protected Dictionary<string, INavigationViewItem> PageIdOrTargetTagNavigationViewsDictionary
|
||||
@@ -453,7 +453,7 @@ public partial class NavigationView : System.Windows.Controls.Control, INavigati
|
||||
{
|
||||
OnItemInvoked();
|
||||
|
||||
_ = NavigateInternal(navigationViewItem);
|
||||
NavigateInternal(navigationViewItem);
|
||||
}
|
||||
|
||||
internal void ToggleAllExpands()
|
||||
|
||||
@@ -347,7 +347,7 @@ public partial class NavigationView
|
||||
frameworkViewContent.DataContext = dataContext;
|
||||
}
|
||||
|
||||
_ = NavigationViewContentPresenter.Navigate(content);
|
||||
NavigationViewContentPresenter.Navigate(content);
|
||||
}
|
||||
|
||||
private void OnNavigationViewContentPresenterNavigated(
|
||||
@@ -360,7 +360,7 @@ public partial class NavigationView
|
||||
return;
|
||||
}
|
||||
|
||||
_ = frame.RemoveBackEntry();
|
||||
frame.RemoveBackEntry();
|
||||
|
||||
/*var replaced = 1;
|
||||
((NavigationViewContentPresenter)sender).JournalOwnership =*/
|
||||
@@ -506,7 +506,7 @@ public partial class NavigationView
|
||||
|
||||
for (var j = navigationStackCount - 1; j >= navigationStackCount - length; j--)
|
||||
{
|
||||
_ = NavigationStack.Remove(NavigationStack[j]);
|
||||
NavigationStack.Remove(NavigationStack[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -344,12 +344,12 @@ public partial class NavigationView
|
||||
{
|
||||
foreach(var item in newItemsSource)
|
||||
{
|
||||
_ = navigationView.FooterMenuItems.Add(item);
|
||||
navigationView.FooterMenuItems.Add(item);
|
||||
}
|
||||
}
|
||||
else if(e.NewValue != null)
|
||||
{
|
||||
_ = navigationView.FooterMenuItems.Add(e.NewValue);
|
||||
navigationView.FooterMenuItems.Add(e.NewValue);
|
||||
}
|
||||
|
||||
if(e.NewValue is INotifyCollectionChanged oc)
|
||||
@@ -429,7 +429,7 @@ public partial class NavigationView
|
||||
{
|
||||
foreach(var item in e.NewItems)
|
||||
{
|
||||
_ = collection.Add(item);
|
||||
collection.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,12 +483,12 @@ public partial class NavigationView
|
||||
{
|
||||
foreach(var item in newItemsSource)
|
||||
{
|
||||
_ = navigationView.MenuItems.Add(item);
|
||||
navigationView.MenuItems.Add(item);
|
||||
}
|
||||
}
|
||||
else if(e.NewValue != null)
|
||||
{
|
||||
_ = navigationView.MenuItems.Add(e.NewValue);
|
||||
navigationView.MenuItems.Add(e.NewValue);
|
||||
}
|
||||
|
||||
if(e.NewValue is INotifyCollectionChanged oc)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 824 B |
@@ -322,7 +322,7 @@
|
||||
Margin="0,3,0,8"
|
||||
Style="{StaticResource BasePaneButtonStyle}"
|
||||
Visibility="{TemplateBinding IsPaneToggleVisible,
|
||||
Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
Converter={StaticResource BooleanToVisConverter}}">
|
||||
<controls:Button.Icon>
|
||||
<controls:SymbolIcon Symbol="LineHorizontal320" />
|
||||
</controls:Button.Icon>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<Thickness x:Key="PaneToggleButtonThickness">1,1,1,1</Thickness>
|
||||
|
||||
<converters:BackButtonVisibilityToVisibilityConverter x:Key="BackButtonVisibilityToVisibilityConverter" />
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
<converters:BooleanToVisConverter x:Key="BooleanToVisConverter" />
|
||||
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
|
||||
/* Based on Windows UI Library */
|
||||
|
||||
using WPFluent.Abstractions;
|
||||
using WPFluent.Animations;
|
||||
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
using System.Windows.Navigation;
|
||||
|
||||
using WPFluent.Abstractions;
|
||||
using WPFluent.Animations;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace WPFluent.Controls;
|
||||
|
||||
@@ -65,9 +67,9 @@ public class NavigationViewContentPresenter : Frame
|
||||
|
||||
public NavigationViewContentPresenter()
|
||||
{
|
||||
Navigating += static(sender, eventArgs) =>
|
||||
Navigating += static (sender, eventArgs) =>
|
||||
{
|
||||
if(eventArgs.Content is null)
|
||||
if (eventArgs.Content is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -76,11 +78,11 @@ public class NavigationViewContentPresenter : Frame
|
||||
self.OnNavigating(eventArgs);
|
||||
};
|
||||
|
||||
Navigated += static(sender, eventArgs) =>
|
||||
Navigated += static (sender, eventArgs) =>
|
||||
{
|
||||
var self = (NavigationViewContentPresenter)sender;
|
||||
|
||||
if(eventArgs.Content is null)
|
||||
if (eventArgs.Content is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -91,12 +93,12 @@ public class NavigationViewContentPresenter : Frame
|
||||
|
||||
private void ApplyTransitionEffectToNavigatedPage(object content)
|
||||
{
|
||||
if(TransitionDuration < 1)
|
||||
if (TransitionDuration < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_ = TransitionAnimationProvider.ApplyTransition(content, Transition, TransitionDuration);
|
||||
TransitionAnimationProvider.ApplyTransition(content, Transition, TransitionDuration);
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage(
|
||||
@@ -107,16 +109,16 @@ public class NavigationViewContentPresenter : Frame
|
||||
{
|
||||
// The order in which the OnNavigatedToAsync/OnNavigatedFromAsync methods of View and ViewModel are called
|
||||
// is not guaranteed
|
||||
if(content is INavigationAware navigationAwareContent)
|
||||
if (content is INavigationAware navigationAwareContent)
|
||||
{
|
||||
function(navigationAwareContent);
|
||||
}
|
||||
|
||||
if(content is INavigableView<object> { ViewModel: INavigationAware navigationAwareViewModel })
|
||||
if (content is INavigableView<object> { ViewModel: INavigationAware navigationAwareViewModel })
|
||||
{
|
||||
function(navigationAwareViewModel);
|
||||
}
|
||||
else if(content is FrameworkElement { DataContext: INavigationAware viewModel } &&
|
||||
else if (content is FrameworkElement { DataContext: INavigationAware viewModel } &&
|
||||
!ReferenceEquals(viewModel, content))
|
||||
{
|
||||
function(viewModel);
|
||||
@@ -134,9 +136,9 @@ public class NavigationViewContentPresenter : Frame
|
||||
base.OnInitialized(e);
|
||||
|
||||
// REVIEW: I didn't understand something, but why is it necessary?
|
||||
Unloaded += static(sender, _) =>
|
||||
Unloaded += static (sender, _) =>
|
||||
{
|
||||
if(sender is NavigationViewContentPresenter navigator)
|
||||
if (sender is NavigationViewContentPresenter navigator)
|
||||
{
|
||||
NotifyContentAboutNavigatingFrom(navigator.Content);
|
||||
}
|
||||
@@ -145,7 +147,7 @@ public class NavigationViewContentPresenter : Frame
|
||||
|
||||
protected override void OnMouseDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if(e.ChangedButton is MouseButton.XButton1 or MouseButton.XButton2)
|
||||
if (e.ChangedButton is MouseButton.XButton1 or MouseButton.XButton2)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
@@ -158,7 +160,7 @@ public class NavigationViewContentPresenter : Frame
|
||||
{
|
||||
ApplyTransitionEffectToNavigatedPage(eventArgs.Content);
|
||||
|
||||
if(eventArgs.Content is not DependencyObject dependencyObject)
|
||||
if (eventArgs.Content is not DependencyObject dependencyObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -170,7 +172,7 @@ public class NavigationViewContentPresenter : Frame
|
||||
{
|
||||
NotifyContentAboutNavigatingTo(eventArgs.Content);
|
||||
|
||||
if(eventArgs.Navigator is not NavigationViewContentPresenter navigator)
|
||||
if (eventArgs.Navigator is not NavigationViewContentPresenter navigator)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -180,7 +182,7 @@ public class NavigationViewContentPresenter : Frame
|
||||
|
||||
protected override void OnPreviewKeyDown(KeyEventArgs e)
|
||||
{
|
||||
if(e.Key == Key.F5)
|
||||
if (e.Key == Key.F5)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 824 B |
@@ -206,12 +206,12 @@ public class NavigationViewItem : System.Windows.Controls.Primitives.ButtonBase,
|
||||
{
|
||||
foreach (var item in newItemsSource)
|
||||
{
|
||||
_ = navigationViewItem.MenuItems.Add(item);
|
||||
navigationViewItem.MenuItems.Add(item);
|
||||
}
|
||||
}
|
||||
else if (e.NewValue != null)
|
||||
{
|
||||
_ = navigationViewItem.MenuItems.Add(e.NewValue);
|
||||
navigationViewItem.MenuItems.Add(e.NewValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user