Skip to content

Instantly share code, notes, and snippets.

View tallichet's full-sized avatar

Cédric Tallichet tallichet

View GitHub Profile
@tallichet
tallichet / SplitViewStyles.xaml
Last active August 29, 2015 14:24
Styles for creating a Windows 10 SplitView
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- design reference http://osguni/?id=19359&Background=19361 -->
<SolidColorBrush x:Key="SplitViewBackgroundBrush" Color="LightGray" /> <!--Color="{ThemeResource SystemBaseMediumColor}" Opacity="1" />-->
<SolidColorBrush x:Key="SplitViewForegroundBrush" Color="{ThemeResource SystemBaseHighColor}" />
<SolidColorBrush x:Key="SplitViewSeparatorBrush" Color="DarkGray" />
<SolidColorBrush x:Key="NavButtonPressedBackgroundBrush" Color="{ThemeResource SystemListMediumColor}" />
@tallichet
tallichet / BooleanTrigger
Created June 24, 2015 09:08
A trigger than can be activated by a boolean. Works just fine with a ToggleButton
using Windows.UI.Xaml;
namespace App1.StateTriggers
{
public class BooleanTrigger : StateTriggerBase
{
public bool Not
{
get { return (bool)GetValue(NotProperty); }
set { SetValue(NotProperty, value); }
@tallichet
tallichet / HorizontalGridViewStyle
Created June 23, 2015 08:54
getting back to the Horizontal GridView as in Windows 8.x
<Style x:Key="HorizontalGridViewStyle" TargetType="GridView">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Auto" />
<Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="False" />
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="False" />
<Setter Property="ItemContainerTransitions">
<Setter.Value>
<TransitionCollection>
@tallichet
tallichet / UI Helper
Created June 23, 2015 08:47
A basic UI helper for finding elements in Visual Tree for Windows 10 UWP app
using System.Collections.Generic;
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
namespace App1
{
public static class UIHelper
{
public static Rect GetElementRect(this FrameworkElement element)
@tallichet
tallichet / ListViewBaseScrollingTrigger
Created June 23, 2015 08:46
VisualState Trigger depending on the scrollviewer H/V offset of List/Grid View
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace App1.StateTriggers
{
public class ListViewBaseScrollingTrigger : StateTriggerBase
{
private ListViewBase _listViewBase;
public ListViewBaseScrollingTrigger()
@tallichet
tallichet / TargetSizeStateTrigger
Created June 23, 2015 06:59
A VisualState Trigger to watching for an element size, working the same way the core AdaptativeTrigger
using Windows.UI.Xaml;
namespace App1.StateTriggers
{
public class TargetSizeStateTrigger : StateTriggerBase
{
private FrameworkElement _target;
public FrameworkElement TargetElement
{
@tallichet
tallichet / PortraitOrLandscapeTrigger
Created June 23, 2015 06:58
A VisualState Trigger to detect layout mode (Portrait / Landscape)
using Windows.UI.Xaml;
namespace App1.StateTriggers
{
public class PortraitOrLandscapeTrigger : StateTriggerBase
{
private readonly Window _window;
private PortraitLandscapeMode _mode;
@tallichet
tallichet / CurrentPageTrigger
Created June 23, 2015 06:55
A VisualState Trigger to detect the current page type displayed as content of a SplitView
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace App1.StateTriggers
{
public class CurrentPageTrigger : StateTriggerBase
{
private SplitView _splitView;
public FrameworkElement TargetElement