forked from duchuule/vba10
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavMenuListView.h
50 lines (43 loc) · 1.88 KB
/
NavMenuListView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
using namespace Windows::Foundation;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Input;
namespace VBA10
{
namespace Controls
{
/// <summary>
/// A specialized ListView to represent the items in the navigation menu.
/// </summary>
/// <remarks>
/// This class handles the following:
/// 1. Sizes the panel that hosts the items so they fit in the hosting pane. Otherwise, the keyboard
/// may appear cut off on one side b/c the Pane clips instead of affecting layout.
/// 2. Provides a single selection experience where keyboard focus can move without changing selection.
/// Both the 'Space' and 'Enter' keys will trigger selection. The up/down arrow keys can move
/// keyboard focus without triggering selection. This is different than the default behavior when
/// SelectionMode == Single. The default behavior for a ListView in single selection requires using
/// the Ctrl + arrow key to move keyboard focus without triggering selection. Users won't expect
/// this type of keyboarding model on the nav menu.
/// </remarks>
public ref class NavMenuListView sealed : public ListView
{
public:
NavMenuListView();
event EventHandler<ListViewItem^>^ ItemInvoked;
void SetSelectedItem(ListViewItem^ item);
void InvokeItem(Object^ focusedItem);
protected:
virtual void OnApplyTemplate() override;
//virtual void OnKeyDown(KeyRoutedEventArgs^ e) override;
private:
SplitView^ _splitViewHost;
void ItemClickHandler(Object^ sender, ItemClickEventArgs^ e);
void OnLoaded(Object ^sender, RoutedEventArgs ^e);
void OnPaneToggled();
void IsOpenPanePropertyChangedCallback(DependencyObject^ sender, DependencyProperty^ args);
//void TryMoveFocus(FocusNavigationDirection direction);
};
}
}