-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from RatioInteractive/dev
0.9.0.0 Build cut
- Loading branch information
Showing
17 changed files
with
729 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System.Diagnostics; | ||
using System.Windows.Input; | ||
using Windows.System; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Input; | ||
|
||
namespace Ratio.UWP.Controls | ||
{ | ||
public class BaseItem :GridViewItem | ||
{ | ||
public static readonly DependencyProperty SelectedCommandProperty = DependencyProperty.Register( | ||
"SelectedCommand", typeof(ICommand), typeof(BaseItem), new PropertyMetadata(default(ICommand))); | ||
|
||
public ICommand SelectedCommand | ||
{ | ||
get => (ICommand)GetValue(SelectedCommandProperty); | ||
set => SetValue(SelectedCommandProperty, value); | ||
} | ||
public object SourceItem { get; set; } | ||
|
||
protected override void OnTapped(TappedRoutedEventArgs e) | ||
{ | ||
if (SelectedCommand != null) | ||
{ | ||
if (SelectedCommand.CanExecute(SourceItem)) | ||
{ | ||
SelectedCommand.Execute(SourceItem); | ||
e.Handled = true; | ||
} | ||
} | ||
base.OnTapped(e); | ||
} | ||
|
||
protected override void OnKeyUp(KeyRoutedEventArgs e) | ||
{ | ||
// Debug.WriteLine($"Key captured by item control. Key: {e.OriginalKey}"); | ||
if ((e.OriginalKey == VirtualKey.GamepadA || e.Key == VirtualKey.Space || e.Key == VirtualKey.Enter) && SelectedCommand != null) | ||
{ | ||
if (SelectedCommand.CanExecute(SourceItem)) | ||
{ | ||
SelectedCommand.Execute(SourceItem); | ||
e.Handled = true; | ||
} | ||
} | ||
base.OnKeyUp(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
using System.Diagnostics; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Input; | ||
|
||
namespace Ratio.UWP.Controls | ||
{ | ||
public sealed class CarouselItem : GridViewItem | ||
public sealed class CarouselItem : BaseItem | ||
{ | ||
public object SourceItem { get; set; } | ||
public CarouselItem() | ||
{ | ||
TabFocusNavigation = KeyboardNavigationMode.Once; | ||
DefaultStyleKey = typeof(CarouselItem); | ||
} | ||
|
||
protected override void OnGotFocus(RoutedEventArgs e) | ||
{ | ||
Debug.WriteLine("Carousel Item got focus."); | ||
base.OnGotFocus(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.