This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows; | |
using System.Windows.Controls; | |
namespace HowToBetterUtilizeGrid; | |
static class GridAssist | |
{ | |
#region AutoRowColumn | |
public static string GetAutoRowColumn(DependencyObject obj) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
public class AsyncBarrier | |
{ | |
/// <summary> | |
/// The number of participants being synchronized. | |
/// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DynamicMethodInvoker | |
{ | |
public static void Invoke(object targetObject, string methodName) | |
{ | |
if (targetObject == null) | |
throw new ArgumentNullException(nameof(targetObject)); | |
if (methodName == null) | |
throw new ArgumentNullException(nameof(methodName)); | |
var targetObjectType = targetObject.GetType(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Xaml.Behaviors; | |
using System.ComponentModel; | |
using System.Reflection; | |
using System.Windows; | |
public class ChangeAttachedPropertyAction : TargetedTriggerAction<UIElement> | |
{ | |
public Type? ClassType | |
{ | |
get { return (Type)GetValue(ClassTypeProperty); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
public class CancelableProcessTask | |
{ | |
private readonly string _filename; | |
private readonly string _arguments; | |
private Process? _process; | |
private TaskCompletionSource? _tcs; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using var bus = new MessageBus(); | |
bool isCompleted = false; | |
var reactionDelay = TimeSpan.FromSeconds(0.25); | |
var timReactionDelay = TimeSpan.FromSeconds(0.3); | |
var ronnieSilenceThreshold = TimeSpan.FromSeconds(3); | |
bus.Messages | |
.Subscribe( | |
m => $"[{DateTime.Now:mm:ss.fff}] {m.Sender}: {m.Content}".Dump(), | |
() => isCompleted = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows; | |
using System.Windows.Controls; | |
public class GridHelper | |
{ | |
#region Rows & Columns | |
public static string GetRows(DependencyObject obj) | |
{ | |
return (string)obj.GetValue(RowsProperty); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.md-alert-text { | |
font-size: 1rem; | |
font-weight: 600; | |
} | |
.md-alert-text-container::after { | |
text-transform: uppercase; | |
position: relative; | |
bottom: 1px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var demo = new Demo(); | |
demo.FieldValue = 10; | |
demo.PropValue = 10; | |
// 修改字段的值 | |
ModifyFieldValue(ref demo.FieldValue, 42); | |
demo.FieldValue.Dump("Field Value"); | |
// 修改属性的值 | |
// ModifyFieldValue(ref demo.PropValue, 42); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Controls.Primitives; | |
namespace DataGridView | |
{ | |
public class MultiSelectorHelper | |
{ |
NewerOlder