Skip to content

Instantly share code, notes, and snippets.

Matt Lacey mrlacey

Block or report user

Report or block mrlacey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mrlacey
mrlacey / intro2uno.demosnippets
Created Dec 3, 2019
For my 'Introducing Uno Platform' talk
View intro2uno.demosnippets
TAB: Introduction to Uno
- 1) ElementBinding Text
<StackPanel Margin="20">
<TextBlock Text="Hello, world !" Margin="20" FontSize="30" />
<TextBox x:Name="EnteredText" />
<TextBlock Text="{Binding ElementName=EnteredText, Path=Text}" />
</StackPanel>
View UwpDesignTimeDataDemo1.xaml.diff
<Page
x:Class="App92.Views.SettingsPage"
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"
Style="{StaticResource PageStyle}"
xmlns:helper="using:App92.Helpers"
xmlns:xaml="using:Windows.UI.Xaml"
+ xmlns:dt="using:UwpDesignTimeData"
@mrlacey
mrlacey / GridLines.cs
Created Dec 8, 2018
UWP Grid ShowGridLines
View GridLines.cs
public class GridLines : DependencyObject
{
public static readonly DependencyProperty AreVisibleProperty =
DependencyProperty.RegisterAttached(
"AreVisible",
typeof(Boolean),
typeof(GridLines),
new PropertyMetadata(false, OnPropertyChanged)
);
@mrlacey
mrlacey / StrRevVizBenchamarks.cs
Created Nov 12, 2018
Code used in benchmark tests for StringResourceVisualizer when reviewing cahnging string manipulation to use Span<T>
View StrRevVizBenchamarks.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
@mrlacey
mrlacey / AutomatedWizardTestingBase.cs
Last active Apr 24, 2018
Base class for WinAppDriver based UI tests
View AutomatedWizardTestingBase.cs
public class AutomatedWizardTestingBase : IDisposable
{
protected WindowsDriver<WindowsElement> AppSession { get; private set; }
protected AutomatedWizardTestingBase()
{
CheckWinAppDriverInstalled();
StartWinAppDriverIfNotRunning();
}
@mrlacey
mrlacey / IsOneOfBenchmarks.cs
Last active Oct 10, 2017
Benchmark tests comparing ways of matching a variable against multiple possible options. As created for http://www.mrlacey.com/2017/10/optimizing-comparison-of-variable-with.html
View IsOneOfBenchmarks.cs
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Linq;
namespace IsOneOfBenchmarks
{
class Program
{
static void Main(string[] args)
{
View MediaDial.xaml
<Page
x:Class="MediaDial.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">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel Padding="50">
View ImprovedOnlyDebugBuild.cs
using Windows.UI.Xaml.Controls;
namespace OnlyIn
{
public class DebugBuild : ContentControl
{
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
@mrlacey
mrlacey / DebugBuildOnly.cs
Created Nov 8, 2016
For creating XAML based solution for limiting which build controls are included in
View DebugBuildOnly.cs
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace OnlyIn
{
public class DebugBuild : ContentControl
{
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
@mrlacey
mrlacey / AdMediatorSizeByDevice.xaml
Last active Oct 12, 2015
Example of how to change the size of the AdMediatorControl depending on the device width.
View AdMediatorSizeByDevice.xaml
<Grid>
<Universal:AdMediatorControl x:Name="AdControl"
Id="ecba2d7a-f2d9-43bb-ab12-f8c5df300987"
Height="90"
Width="728" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="VisualStateGroup">
<VisualState x:Name="Mobile">
<VisualState.StateTriggers>
You can’t perform that action at this time.