Skip to content

Commit

Permalink
Merge pull request #16 from RatioInteractive/dev
Browse files Browse the repository at this point in the history
0.9.0.0 Build cut
  • Loading branch information
Mike McAulay authored Feb 6, 2018
2 parents fddcfdb + cfe2959 commit b8c3eea
Show file tree
Hide file tree
Showing 17 changed files with 729 additions and 222 deletions.
49 changes: 49 additions & 0 deletions BaseItem.cs
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);
}
}
}
14 changes: 2 additions & 12 deletions CarouselItem.cs
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);
}
}
}
1 change: 0 additions & 1 deletion ControlUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public static DependencyObject LookUpTreeByType(DependencyObject dependencyObjec
continue;
}
return null;
break;
}
}

Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
[assembly: ComVisible(false)]
Loading

0 comments on commit b8c3eea

Please sign in to comment.