View ItemViewModel.cs
public class ItemViewModel
{
public string Title { get; set; }
public string ThumbnailUrl { get; set; }
public List<string> Details { get; set; }
}
View MainViewModel.cs
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using DetailsDrawer.Annotations;
namespace DetailsDrawer.ViewModels
{
public class MainPageViewModel : INotifyPropertyChanged
{
private ObservableCollection<RouteStep> routeSteps;
View MainPage.xaml.cs
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
namespace DetailsDrawer
{
public sealed partial class MainPage : Page
{
public MainPage()
View MainPage.xaml
<Page x:Class="DetailsDrawer.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DetailsDrawer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:DetailsDrawer.ViewModels"
mc:Ignorable="d">
<Page.DataContext>
View ThemeModel.cs
[DataContract]
public class ThemeModel : INotifyPropertyChanged
{
private Color backgroundColor;
private Color textColor;
private Color buttonBackgroundColor;
private Color buttonTextColor;
private Color accentColor;
private Color headerColor;
View FadeHeaderBehavior.cs
public class FadeHeaderBehavior : Behavior<FrameworkElement>
{
public static readonly DependencyProperty HeaderElementProperty = DependencyProperty.Register(
"HeaderElement", typeof(UIElement), typeof(FadeHeaderBehavior), new PropertyMetadata(null, PropertyChangedCallback));
public UIElement HeaderElement
{
get { return (UIElement) GetValue(HeaderElementProperty); }
set { SetValue(HeaderElementProperty, value); }
}
View OnTargetPlatform
public class OnTargetPlatform<T> : OnPlatform<T>
{
public T Windows { get; set; }
public static implicit operator T(OnTargetPlatform<T> onPlatform) => Device.OS == TargetPlatform.Windows ? onPlatform.Windows : (OnPlatform<T>) onPlatform;
}
View ParallaxWithOpacityBehavior.cs
public class ParallaxWithOpacityBehavior : Behavior<FrameworkElement>
{
#region DependencyProperties
/// <summary>
/// Gets or sets the element that will parallax while scrolling.
/// </summary>
public UIElement ParallaxContent
{
get { return (UIElement)GetValue(ParallaxContentProperty); }
View AddAndRemoveTask
#region Background Task management
private async Task<bool> ConfigureBackgroundTaskAsync()
{
try
{
vm.IsBusy = true;
vm.IsBusyMessage = "configuring Background Task";
var accessStatus = await BackgroundExecutionManager.RequestAccessAsync();
View TaskHelpers.cs
public static class TaskHelpers
{
public static async Task RegisterTaskAsync(string taskFriendlyName, string taskEntryPoint, uint taskRunFrequency, SystemConditionType condition = SystemConditionType.InternetAvailable)
{
try
{
//if task already exists, unregister it before adding it
foreach (var task in BackgroundTaskRegistration.AllTasks.Where(cur => cur.Value.Name == taskFriendlyName))
{
task.Value.Unregister(true);