Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Commit

Permalink
Re-added Controls and Sample app components
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcroft committed Jan 3, 2017
1 parent 10609b5 commit 35614a7
Show file tree
Hide file tree
Showing 180 changed files with 12,969 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -250,3 +250,4 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml
*.appx
8 changes: 4 additions & 4 deletions WinUX.UWP.MvvmLight/Common/ViewModels/CoreViewModelBase.cs
Expand Up @@ -105,10 +105,10 @@ public INavigationService NavigationService
: Mvvm.Services.NavigationService.Current;

/// <summary>
/// Gets the <see cref="MessageDialogHelper"/> for the view that created this view model.
/// Gets the <see cref="MessageDialogManager"/> for the view that created this view model.
/// </summary>
public MessageDialogHelper Dialog
=> this.IsSecondaryView ? ViewMessageDialogManager.Current.Get(this.ViewId) : MessageDialogHelper.Current;
public MessageDialogManager Dialog
=> this.IsSecondaryView ? ViewMessageDialogManager.Current.Get(this.ViewId) : MessageDialogManager.Current;

/// <inheritdoc />
public override void RaisePropertyChanged(string propertyName = null)
Expand Down Expand Up @@ -178,7 +178,7 @@ private void RegisterWithView()
{
ViewMessageDialogManager.Current.RegisterOrUpdate(
this.ViewId,
new MessageDialogHelper(viewDispatcher));
new MessageDialogManager(viewDispatcher));
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions WinUX.UWP.Samples/App.xaml
@@ -0,0 +1,18 @@
<Application
x:Class="WinUX.UWP.Samples.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:samples="using:WinUX.UWP.Samples"
RequestedTheme="Light">

<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///WinUX.UWP.Xaml/Themes/Generic.xaml" />
<ResourceDictionary Source="AppResources.xaml" />
</ResourceDictionary.MergedDictionaries>

<samples:Locator x:Key="Locator" />
</ResourceDictionary>
</Application.Resources>
</Application>
133 changes: 133 additions & 0 deletions WinUX.UWP.Samples/App.xaml.cs
@@ -0,0 +1,133 @@
namespace WinUX.UWP.Samples
{
using System;
using System.Threading.Tasks;

using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation.Metadata;
using Windows.UI;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

using GalaSoft.MvvmLight.Ioc;

using WinUX.ApplicationModel.Lifecycle;
using WinUX.Design.Material;
using WinUX.Diagnostics;
using WinUX.Diagnostics.Tracing;
using WinUX.Mvvm.Services;
using WinUX.UWP.Samples.ViewModels;
using WinUX.Xaml;

public sealed partial class App : Application
{
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
this.Resuming += OnResuming;
}

protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
UpdateTitleBar();

Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame == null)
{
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
Window.Current.Content = rootFrame;

await AppDiagnostics.Current.StartAsync();
}

UIDispatcher.Initialize();

if (e.PrelaunchActivated) return;

if (rootFrame.Content == null)
{
await InitializeAppShellAsync(e.Arguments);
rootFrame.Navigate(typeof(AppShell));
}

Window.Current.Activate();
}

private static async Task InitializeAppShellAsync(object navigationParameter)
{
try
{
var shellVm = SimpleIoc.Default.GetInstance<AppShellViewModel>();
if (shellVm != null)
{
await shellVm.InitializeAsync();
}
}
catch (Exception ex)
{
EventLogger.Current.WriteError(ex.Message);
}

NavigationService.Current.Navigate(typeof(MainPage), navigationParameter);
}

private static void UpdateTitleBar()
{
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
{
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
if (titleBar != null)
{
titleBar.ForegroundColor = Colors.White;
titleBar.BackgroundColor = MaterialDesignColors.Blue.Color700;

titleBar.ButtonInactiveForegroundColor = Colors.Black;
titleBar.ButtonInactiveBackgroundColor = MaterialDesignColors.Blue.Color50;

titleBar.InactiveForegroundColor = Colors.Black;
titleBar.InactiveBackgroundColor = MaterialDesignColors.Blue.Color100;

titleBar.ButtonHoverForegroundColor = Colors.Black;
titleBar.ButtonHoverBackgroundColor = MaterialDesignColors.Blue.Color400;

titleBar.ButtonForegroundColor = Colors.White;
titleBar.ButtonBackgroundColor = MaterialDesignColors.Blue.Color800;

titleBar.ButtonPressedForegroundColor = Colors.White;
titleBar.ButtonPressedBackgroundColor = MaterialDesignColors.Blue.Color900;
}
}

if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
var statusBar = StatusBar.GetForCurrentView();
if (statusBar != null)
{
statusBar.BackgroundOpacity = 1;
statusBar.BackgroundColor = MaterialDesignColors.Blue.Color700;
statusBar.ForegroundColor = Colors.White;
}
}
}

private static void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}

private static void OnSuspending(object sender, SuspendingEventArgs e)
{
AppLifecycleManager.Current.SuspendAsync(e);
}

private static void OnResuming(object sender, object e)
{
AppLifecycleManager.Current.ResumeAsync();
}
}
}
73 changes: 73 additions & 0 deletions WinUX.UWP.Samples/AppResources.xaml
@@ -0,0 +1,73 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Style x:Key="StandardListViewStyle" TargetType="ListViewBase">
<Setter Property="Padding" Value="0,0,0,0"/>
<Setter Property="MinHeight" Value="0" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="TabNavigation" Value="Once"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled"/>
<Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="False"/>
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled"/>
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="False"/>
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled"/>
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False"/>
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True"/>
<Setter Property="IsSwipeEnabled" Value="True"/>
<Setter Property="Width" Value="Auto" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="ItemContainerTransitions">
<Setter.Value>
<TransitionCollection>
<AddDeleteThemeTransition/>
<ContentThemeTransition/>
<ReorderThemeTransition/>
<EntranceThemeTransition IsStaggeringEnabled="False"/>
</TransitionCollection>
</Setter.Value>
</Setter>

<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<ItemsStackPanel Orientation="Vertical" Width="Auto" HorizontalAlignment="Stretch"/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewBase">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<ScrollViewer x:Name="ScrollViewer" AutomationProperties.AccessibilityView="Raw" BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsHorizontalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsHorizontalScrollChainingEnabled}" IsVerticalScrollChainingEnabled="{TemplateBinding ScrollViewer.IsVerticalScrollChainingEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" TabNavigation="{TemplateBinding TabNavigation}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
<ItemsPresenter FooterTransitions="{TemplateBinding FooterTransitions}" FooterTemplate="{TemplateBinding FooterTemplate}" Footer="{TemplateBinding Footer}" HeaderTemplate="{TemplateBinding HeaderTemplate}" Header="{TemplateBinding Header}" HeaderTransitions="{TemplateBinding HeaderTransitions}" Padding="{TemplateBinding Padding}"/>
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ItemContainerStyle" TargetType="SelectorItem">
<Setter Property="Height" Value="150" />
<Setter Property="Margin" Value="0,10,0,5" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Width" Value="Auto" />
</Style>

<Style x:Key="SampleBorderStyle" TargetType="Border">
<Setter Property="BorderThickness" Value="0,0,0,1" />
<Setter Property="BorderBrush" Value="{StaticResource SystemControlForegroundAccentBrush}" />
<Setter Property="Padding" Value="10" />
</Style>

<Style x:Key="SampleButtonStyle" TargetType="Button">
<Setter Property="Height" Value="50" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
</ResourceDictionary>
38 changes: 38 additions & 0 deletions WinUX.UWP.Samples/AppShell.xaml
@@ -0,0 +1,38 @@
<views:PageBase
x:Class="WinUX.UWP.Samples.AppShell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:WinUX.Xaml.Controls"
xmlns:views="using:WinUX.MvvmLight.Xaml.Views"
mc:Ignorable="d"
DataContext="{Binding AppShellViewModel, Source={StaticResource Locator}}">

<Grid>
<controls:AppMenu x:Name="AppMenu"
PaneButtonBackground="{StaticResource BlueBrush700}"
PaneButtonForeground="White"
PaneBackground="{StaticResource BlueBrush500}"
AppMenuButtonBackground="Transparent"
AppMenuButtonForeground="White"
AppMenuButtonCheckedBackground="{StaticResource BlueBrush800}"
AppMenuButtonCheckedForeground="White"
AppMenuButtonHoverBackground="{StaticResource BlueBrush400}"
AppMenuButtonPressedBackground="{StaticResource BlueBrush800}"
SecondarySeparatorColor="{StaticResource BlueBrush200}"
PrimaryButtons="{x:Bind ViewModel.PrimaryAppButtons}"
SecondaryButtons="{x:Bind ViewModel.SecondaryAppButtons}"
FlyoutButtons="{x:Bind ViewModel.FlyoutButtons}"
VisualStateNarrowMinWidth="{x:Bind NarrowAdaptiveWidth}"
VisualStateNormalMinWidth="{x:Bind NormalAdaptiveWidth}"
ContentMargin="0,48,0,0"/>

<Grid Height="48" Margin="48,0,0,0" VerticalAlignment="Top" Background="{StaticResource BlueBrush500}">
<TextBlock Margin="10,5" Text="{x:Bind ViewModel.Title, Mode=OneWay}" VerticalAlignment="Center" FontSize="20" FontWeight="Light" Foreground="White" />
</Grid>
</Grid>
</views:PageBase>



35 changes: 35 additions & 0 deletions WinUX.UWP.Samples/AppShell.xaml.cs
@@ -0,0 +1,35 @@
namespace WinUX.UWP.Samples
{
using WinUX.Mvvm.Services;
using WinUX.UWP.Samples.ViewModels;
using WinUX.Xaml.Controls;

/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class AppShell
{
public AppShell()
{
Instance = this;
this.InitializeComponent();

this.AppMenu.NavigationService = NavigationService.Current;
}

/// <summary>
/// Gets the instance of the shell.
/// </summary>
public static AppShell Instance { get; private set; }

/// <summary>
/// Gets the app menu.
/// </summary>
public static AppMenu Menu => Instance.AppMenu;

/// <summary>
/// Gets the data context for the app shell.
/// </summary>
public AppShellViewModel ViewModel => this.DataContext as AppShellViewModel;
}
}
Binary file added WinUX.UWP.Samples/Assets/Icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUX.UWP.Samples/Assets/NewStoreLogo.scale-100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUX.UWP.Samples/Assets/NewStoreLogo.scale-125.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUX.UWP.Samples/Assets/StoreLogo.scale-100.png
Binary file added WinUX.UWP.Samples/Assets/StoreLogo.scale-125.png
Binary file added WinUX.UWP.Samples/Assets/StoreLogo.scale-150.png
Binary file added WinUX.UWP.Samples/Assets/StoreLogo.scale-200.png
Binary file added WinUX.UWP.Samples/Assets/StoreLogo.scale-400.png
15 changes: 15 additions & 0 deletions WinUX.UWP.Samples/Components/IntegerSampleProperty.cs
@@ -0,0 +1,15 @@
namespace WinUX.UWP.Samples.Components
{
public sealed class IntegerSampleProperty : SampleProperty
{
/// <summary>
/// Gets or sets the minimum integer value.
/// </summary>
public double MinValue { get; set; }

/// <summary>
/// Gets or sets the maximum integer value.
/// </summary>
public double MaxValue { get; set; }
}
}
13 changes: 13 additions & 0 deletions WinUX.UWP.Samples/Components/PropertyPane.xaml
@@ -0,0 +1,13 @@
<UserControl
x:Class="WinUX.UWP.Samples.Components.PropertyPane"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
DataContextChanged="OnDataContextChanged">

<ScrollViewer RequestedTheme="Light">
<StackPanel x:Name="RootPanel" Padding="15,20,15,20" Background="{StaticResource BlueBrush50}" />
</ScrollViewer>
</UserControl>

0 comments on commit 35614a7

Please sign in to comment.