Skip to content

Instantly share code, notes, and snippets.

View michael-hawker's full-sized avatar

Michael Hawker MSFT (XAML Llama) michael-hawker

View GitHub Profile
@michael-hawker
michael-hawker / openother.js
Created June 21, 2017 16:03
Windows 10 JavaScript Example which Simply Opens Native Calendar/Mail/People Applications without any context
window.addEventListener("DOMContentLoaded", (ev) => {
if (typeof Windows !== 'undefined') {
document.getElementById("calendar").addEventListener("click", () => {
Windows.ApplicationModel.Appointments.AppointmentManager.showTimeFrameAsync(new Date(Date.now()), 1);
});
document.getElementById("mail").addEventListener("click", () => {
Windows.System.Launcher.launchUriAsync(new Windows.Foundation.Uri("mailto:"));
});
document.getElementById("people").addEventListener("click", () => {
Windows.System.Launcher.launchUriAsync(new Windows.Foundation.Uri("ms-people:"));
@michael-hawker
michael-hawker / internetconnectivity.js
Created June 21, 2017 16:05
Windows 10 JavaScript Example which detects Internet Connection Properties
window.addEventListener("DOMContentLoaded", (ev) => {
if (typeof Windows !== 'undefined') {
var profile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
var connectivity = profile.getNetworkConnectivityLevel();
document.getElementById("connectionstatus").innerHTML = connectivity;
document.getElementById("hasinternet").innerHTML = (connectivity == Windows.Networking.Connectivity.NetworkConnectivityLevel.internetAccess);
document.getElementById("islan").innerHTML = profile.isWlanConnectionProfile;
document.getElementById("iswan").innerHTML = profile.isWwanConnectionProfile;
} else {
@michael-hawker
michael-hawker / Calc.cs
Created February 16, 2018 09:50
UWP Custom Markup Extension Example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Markup;
namespace CustomMarkupExtensionRS3
{
[MarkupExtensionReturnType(ReturnType = typeof(int))]
<Page
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">
<ScrollViewer>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;
@michael-hawker
michael-hawker / BooleanToTextConverter.cs
Last active May 14, 2024 07:23
Advanced UWP MarkupExtension as IValueConverter + XAML Escape Characters
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Markup;
namespace MarkupExtensionTest
{
@michael-hawker
michael-hawker / XAMLing.json
Created January 29, 2020 19:13
#XAMLing XAML Studio Example
{
"Items":
[
{
"index": 1,
"def": "Iterate a design with XAML for fun.",
},
{
"index": 2,
"def": "Explore new things with XAML.",
@michael-hawker
michael-hawker / squares.txt
Created April 27, 2020 20:46
XAML Llama's "Llamingo" Bingo Board Squares
🆕 Issue/PR
Close Issue/PR ✅
Discover Typo in Docs 📑
Uses XAML Studio
Uses 🧰 Sample App
Uses XAML Controls Gallery 🖼
Talks about 🦙s
Mentions Green 🟢 Screen
Mentions WinUI
Mentions Win2D
@michael-hawker
michael-hawker / SegmentedControlTest.xaml
Created December 4, 2020 00:36
Example test of trying to re-style a `RadioButtons` control to look like a Segmented Control.
<!-- See Reference Issues:
https://github.com/microsoft/microsoft-ui-xaml/issues/2310
https://github.com/microsoft/microsoft-ui-xaml/issues/3759
-->
<Page
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:muxc="using:Microsoft.UI.Xaml.Controls"