Skip to content

Instantly share code, notes, and snippets.

View LanceMcCarthy's full-sized avatar
💾
Bashing __(ง'̀-'́)ง__ bugs

Lance McCarthy LanceMcCarthy

💾
Bashing __(ง'̀-'́)ง__ bugs
View GitHub Profile
@LanceMcCarthy
LanceMcCarthy / MainPage.xaml
Created October 15, 2018 18:10
Simple EmptyStringValidator Attached Property
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:SelectionPerPlatform.Portable"
xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
x:Class="Example.Portable.MainPage">
<telerikInput:RadEntry local:TelerikValidator.EmptyStringValidator="True"
VerticalOptions="Center"
Margin="10"/>
</ContentPage>
@LanceMcCarthy
LanceMcCarthy / FadeHeaderBehavior.cs
Last active December 1, 2018 00:04
Fading ListView or GridView Header
public class FadeHeaderBehavior : Behavior<FrameworkElement>
{
public static readonly DependencyProperty HeaderElementProperty = DependencyProperty.Register(
"HeaderElement", typeof(UIElement), typeof(FadeHeaderBehavior), new PropertyMetadata(null, PropertyChangedCallback));
public UIElement HeaderElement
{
get { return (UIElement) GetValue(HeaderElementProperty); }
set { SetValue(HeaderElementProperty, value); }
}
@LanceMcCarthy
LanceMcCarthy / LoginDialog.xaml
Created December 6, 2018 16:03
LoginDialog - A Live SDK authentication helper for UWP applications
<ContentDialog
x:Class="YourUwpApp.LoginDialog"
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"
SecondaryButtonText="cancel"
SecondaryButtonClick="LoginDialog_OnSecondaryButtonClick">
@LanceMcCarthy
LanceMcCarthy / MainPage.xaml
Created December 28, 2018 22:01
Custom Image Slider UWP
<Page x:Class="SliderDemo.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SliderDemo"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.Resources>
@LanceMcCarthy
LanceMcCarthy / ConversionHelpers.cs
Last active January 7, 2019 17:57
A Xamarin.Forms Effect where you can subscribe to an event handler when the keyboard is shown
public static class ConversionHelpers
{
public static Xamarin.Forms.Rectangle AsRectangle(this CGRect o)
{
return new Xamarin.Forms.Rectangle
{
Height = o.Height,
Width = o.Width,
X = o.X,
Y = o.Y,
@LanceMcCarthy
LanceMcCarthy / MainPage.xaml.cs
Created April 18, 2019 17:40
Creating a Pie Chart
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
CreatePieChart();
}
private void CreatePieChart()
<Page x:Class="ShadowBorder.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ShadowBorder"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.DataContext>
@LanceMcCarthy
LanceMcCarthy / MainPage.xaml
Created August 9, 2019 22:07
Custom Commandable ChartSelectionBehavior
<telerikChart:RadCartesianChart>
<telerikChart:RadCartesianChart.ChartBehaviors>
<local:MyChartSelectionBehavior Command="{Binding MyCommand}" DataPointSelectionMode="Single" SeriesSelectionMode="None"/>
</telerikChart:RadCartesianChart.ChartBehaviors>
<!-- See the following documentation for the rest of the code https://docs.telerik.com/devtools/xamarin/controls/chart/behaviors/chart-behaviors-selection-behavior -->
</telerikChart:RadCartesianChart>
@LanceMcCarthy
LanceMcCarthy / MainPage.xaml
Created August 9, 2019 22:21
Xamarin.Forms RadBarcode to Bitmap
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:telerikBarcode="clr-namespace:Telerik.XamarinForms.Barcode;assembly=Telerik.XamarinForms.Barcode"
x:Class="BarcodeCanvasToBitmap.Portable.MainPage">
<Grid>
<telerikBarcode:RadBarcode x:Name="barcode"
Value="https://www.telerik.com/xamarin-ui"
WidthRequest="100"
@LanceMcCarthy
LanceMcCarthy / gist:38e31db561fe939952947c49ccee93c8
Created December 7, 2019 02:11
YAML for Release Pipeline Copy To Azure Blob
steps:
- task: AzureFileCopy@2
displayName: 'AzureBlob File Copy'
inputs:
SourcePath: '$(System.DefaultWorkingDirectory)/YOUR_DROP_FILES/drop/'
azureSubscription: 'YOUR_AZURE_SERVICE_CONNECTION' (use release pipeline task pickers to help and authenticate)
Destination: AzureBlob
storage: NAME_OF_AZURE_STORAGE_ACCOUNT (use release pipeline task pickers to help)
ContainerName: 'YOUR_BLOB_NAME' (find this in Azure, or use desktop Azure Storage Explorer to help)
AdditionalArgumentsForBlobCopy: '/Pattern:*.zip' (IMPORTANT!!! It seems to fail unless you set a folder as SoucePath and use a pattern to match the file extension. Or use *.* if you want all files copied into folder)