Skip to content

Instantly share code, notes, and snippets.

View CheetahChrome's full-sized avatar

William Wegerson CheetahChrome

View GitHub Profile
@CheetahChrome
CheetahChrome / CodeBehind.cs
Created November 7, 2021 18:32
WPF Drag And Drop for Files. Each Event at Miniumum
private void DNDEnter(object sender, DragEventArgs e)
{
if (!e.Data.GetDataPresent(DataFormats.FileDrop) ||
sender == e.Source)
{
e.Effects = DragDropEffects.None;
}
}
private void DNDFeedback(object sender, GiveFeedbackEventArgs e)
@CheetahChrome
CheetahChrome / CodeBehind.cs
Last active November 7, 2021 18:42
WPF Resize Text In Control MouseWheelScroll Event
private void MouseWheelScroll(object sender, MouseWheelEventArgs e)
{
if (Keyboard.Modifiers != ModifierKeys.Control)
return;
var delta = (e.Delta > 0) ? 2 : -2;
var change = VM.MainFontSize + delta;
if (change < 8)
change = 8;
VM.MainFontSize = change;
}
@CheetahChrome
CheetahChrome / ErrorBox.xaml
Last active November 12, 2021 11:35
A WPF ErrorBox
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibility" /> <!-- System.Windows.Controls. -->
</Windown.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="200*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
@CheetahChrome
CheetahChrome / MRU.cs
Last active November 12, 2021 11:44
WPF Menu and Submenu Styling as Blue Gradient Background
public class MRU
{
public string Name { get; set; }
public string Address { get; set; }
public string Data { get; set; }
public bool IsValid => !string.IsNullOrWhiteSpace(Name);
public bool IsFile => !string.IsNullOrWhiteSpace(Address);
@CheetahChrome
CheetahChrome / GenericFKCreateDrop.snippet
Created April 11, 2022 16:15
Visual Studio Snippet to add a FK Relationship with Drop FK
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Generic FK Create/Drop</Title>
<Shortcut>FKMSTS</Shortcut>
<Description>Code snippet for Foreign Key Creation and Dropping</Description>
<Author>William Wegerson</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@CheetahChrome
CheetahChrome / HTTPExtensions.cs
Last active May 9, 2022 13:32
C# Static Class Extensions
/// This is a repistory of many differen extensions I use throughout multiple projects.
/// A location here for ultimate move to other named extensions.
public static class HTTPExtensions
{
/// <summary>
/// Allow one to build a URL from its parts, similar to Path.Combine.
/// </summary>
/// <remarks>HMTL Extensions</Remarks>
/// <param name="baseUrl">Initial bitof the url</param>