Skip to content

Instantly share code, notes, and snippets.

View martinsuchan's full-sized avatar

Martin Suchan martinsuchan

View GitHub Profile
@martinsuchan
martinsuchan / MainPage.xaml
Created February 6, 2014 16:39
AppBarButton exceptions in Windows 8.1
<Page x:Class="BlankApp1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Resources>
<!-- this works -->
<Style x:Key="Style1" TargetType="AppBarButton">
<Setter Property="Icon" Value="Previous" />
</Style>
<!-- these throw exception -->
@martinsuchan
martinsuchan / Class1.cs
Created July 15, 2014 18:21
Visual Studio 14 CTP2 C# notes
using System;
// Using static
using System.Diagnostics.Debug;
using System.Math;
using System.Linq.Enumerable;
using System.Collections.Generic;
#if NETFX_CORE
using Windows.Web.Http;
#else
using System.Net.Http;
@martinsuchan
martinsuchan / MainPage.xaml.cs
Created January 11, 2014 16:11
Baseball Odds - different JSON parsing methods.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.Serialization;
using System.Windows;
using System.Windows.Resources;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@martinsuchan
martinsuchan / ScreenSizeHelper.cs
Created January 21, 2016 08:54
Lumia 950 and 950 XL screen size detection on WP8.1 Silverlight
using System;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using Microsoft.Phone.Info;
namespace PhoneApp1
{
public class ScreenSizeHelper
{
@martinsuchan
martinsuchan / MainPage.xam
Created April 20, 2016 07:38
Broken SecondaryCommands when using AppBarButton->Style
<Page x:Class="App1.MainPage"
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">
<Page.Resources>
<SolidColorBrush x:Key="AppBarForegroundBrush" Color="DarkBlue"/>
<Style x:Key="MyAppBarButtonStyle" TargetType="AppBarButton">
using System;
using System.Diagnostics;
using Windows.Storage;
namespace TinyCore.Storage
{
public abstract class SettingBase
{
/// <summary>
/// Access to LocalSettings must be atomic.
@martinsuchan
martinsuchan / Cursor.cs
Created July 18, 2017 14:07
CoreCursor attached property helper class.
using System.Collections.Generic;
using System.Diagnostics;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;
namespace CursorTest
{
public class Cursor : DependencyObject
{