Skip to content

Instantly share code, notes, and snippets.

@rtanote
rtanote / constrain.cs
Last active December 17, 2015 08:59
processingのconstrain関数をc#でも使えるように。ジェネリック&拡張メソッドにしている。
public static class MiscUtils
{
/// <summary>
/// Constrains a value to not exceed a maximum and minimum value
/// </summary>
/// <typeparam name="Type">IComparable-implementing type</typeparam>
/// <param name="value">the value to constrain</param>
/// <param name="min">minimum limit</param>
/// <param name="max">maximum limit</param>
/// <returns>constrained value</returns>
@rtanote
rtanote / clickButton.xaml
Created May 15, 2013 12:26
xamlでボタンのクリックイベントを実装する場合のいくつかのパターン。
<!-- without Interaction Trigger -->
<Button Content="Hoge"
Command="{Binding DoCommand}"
CommandParameter="hoge"
/>
<!-- Interaction Trigger with InvkeoCommandAction -->
<Button Content="Hoge" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">