Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion AuraClick/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
IsMaximizable="False"
mc:Ignorable="d">

<Grid>
<Grid PointerPressed="RootGrid_PointerPressed">
<Grid.KeyboardAccelerators>
<KeyboardAccelerator
Key="Left"
Invoked="BackAccelerator_Invoked"
Modifiers="Menu" />
</Grid.KeyboardAccelerators>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
Expand Down
25 changes: 25 additions & 0 deletions AuraClick/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
// You should have received a copy of the GNU General Public License
// along with Aura Click. If not, see <https://www.gnu.org/licenses/>.

using Microsoft.UI.Input;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
Expand Down Expand Up @@ -45,4 +47,27 @@ private void TitleBar_BackRequested(TitleBar sender, object args)
{
RootFrame.GoBack();
}

private void BackAccelerator_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
{
if (RootFrame.CanGoBack)
{
RootFrame.GoBack();
args.Handled = true;
}
}

private void RootGrid_PointerPressed(object sender, PointerRoutedEventArgs e)
{
PointerPointProperties props = e.GetCurrentPoint(null).Properties;

if (props.IsXButton1Pressed)
{
if (RootFrame.CanGoBack)
{
RootFrame.GoBack();
e.Handled = true;
}
}
}
}