Skip to content

Instantly share code, notes, and snippets.

View punker76's full-sized avatar
☮️
#PEACE

Jan Karger ツ ☀ punker76

☮️
#PEACE
View GitHub Profile
public class PackIconControl : ContentControl
{
public PackIconControl()
{
SizeChanged += OnSizeChanged;
}
public static readonly DependencyProperty PackIconKindProperty =
DependencyProperty.Register(nameof(PackIconKind), typeof(object), typeof(PackIconControl),
new PropertyMetadata(default(object), PackIconKindPropertyChangedCallback));
@punker76
punker76 / gist:62f1f7da69022a82dd515120cd15d710
Created February 25, 2019 09:21
Can't restore with MSBuild.Sdk.Extras and VS 2019 and .NET Core 3.0 preview
https://dev.azure.com/mahapps/MahApps.Metro.IconPacks/_build/results?buildId=36
##[section]Starting: NuGet restore
==============================================================================
Task : NuGet
Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
Version : 2.147.6
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
==============================================================================
@punker76
punker76 / ItemsControlWithScrollViewer.xaml
Created February 7, 2019 10:10
ItemsControl with ScrollViewer inside Template
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dd="urn:gong-wpf-dragdrop">
<Grid>
<ItemsControl x:Name="pnlBilder"
HorizontalAlignment="Center"
Width="300" Height="100"
dd:DragDrop.IsDragSource="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
@punker76
punker76 / MainWindow.xaml
Created February 6, 2019 20:36
Detecting Windows 10 Dark/Light mode
<Window x:Class="WpfApp1.MainWindow"
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:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
@punker76
punker76 / BubbleScrollEvent.cs
Created September 18, 2018 13:25
BubbleScrollEvent
using System.Windows;
using System.Windows.Input;
using System.Windows.Interactivity;
namespace ExtraBehaviors
{
/// <summary>
/// The BubbleScrollEvent behavior can be used to prevent the mousewheel scrolling on a scrollable control.
/// The event will be bubble up to the parent control.
/// This behavior can be prevent with the left Shift key.
@punker76
punker76 / ScrollSynchronizer.cs
Created July 30, 2018 14:15
ListBox scroll syncronisation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
namespace ListBoxScrollSync
{
@punker76
punker76 / gist:556299e9c25b8e6f1af98f6056a97599
Created April 25, 2018 21:40
dependencyProperty R# template
/// <summary>
/// Identifies the <see cref="$propertyName$"/> dependency property.
/// </summary>
public static readonly $dependencyProperty$ $propertyName$Property
= $dependencyProperty$.Register(nameof($propertyName$), typeof($propertyType$), typeof($containingType$), new PropertyMetadata(default($propertyType$)));
/// <summary>
/// Get or sets the $propertyName$ property.
/// </summary>
public $propertyType$ $propertyName$
@punker76
punker76 / App.config
Last active April 6, 2018 13:45
Show SVG at MahApps IconTemplate with SkiaSharp.Svg
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="SkiaSharp" publicKeyToken="0738eb9f132ed756" culture="neutral" />
@punker76
punker76 / gist:7d554d1e02eb17e1646a5f8fe79058d7
Last active March 26, 2018 15:34
Custom WindowCommands
<controls:MetroWindow.Resources>
<ControlTemplate x:Key="WindowCommandsButtonTemplate" TargetType="{x:Type Button}">
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
<controls:ContentControlEx x:Name="PART_ContentControlEx"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentCharacterCasing="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:WindowCommands}}, Path=(controls:ControlsHelper.ContentCharacterCasing)}"
@punker76
punker76 / Taskbar.cs
Created March 15, 2018 13:00 — forked from franzalex/Taskbar.cs
Class to get the taskbar's position, size and other properties.
/******************************************************************************
* Name: Taskbar.cs
* Description: Class to get the taskbar's position, size and other properties.
* Author: Franz Alex Gaisie-Essilfie
* based on code from https://winsharp93.wordpress.com/2009/06/29/find-out-size-and-position-of-the-taskbar/
*
* Change Log:
* Date | Description
* -------------|--------------------------------------------------------------
* 2017-05-16 | Initial design