This file contains 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
<Window x:Class="WpfApplication38.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Width="200" | |
Height="100"> | |
<TextBox Text="{Binding SampleText}" /> | |
</Window> |
This file contains 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 class MainWindowViewModel : ViewModel | |
{ | |
private double _metricValue, _imperialValue; | |
public ICommand ImperialUnitToMetric { get; private set; } | |
public ICommand MetricToImperialUnit { get; private set; } | |
public MetricUnit CurrentMetricUnit { get; set; } | |
public ImperialUnit CurrentImperialUnit { get; set; } |
This file contains 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
/// <summary> | |
/// <see cref="TextBlock"/> にタイマー機能を付与します。 | |
/// </summary> | |
public class TimerBehavior : Behavior<TextBlock> | |
{ | |
private DispatcherTimer timer; | |
#region Interval 依存関係プロパティ | |
/// <summary> |
This file contains 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
<Grid x:Name="Bg" | |
SnapsToDevicePixels="true"> | |
<Grid.ColumnDefinitions> | |
<ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" /> | |
<ColumnDefinition Width="0.00001*" /> | |
<ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" /> | |
</Grid.ColumnDefinitions> | |
<Border BorderBrush="{TemplateBinding BorderBrush}" | |
BorderThickness="{TemplateBinding BorderThickness}" | |
Background="{TemplateBinding Background}" |
This file contains 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
static class Extensions | |
{ | |
public static IEnumerable<T[]> ふぁぼツバめそっど<T>(this IEnumerable<T> source, Func<T, bool> predicate) | |
{ | |
var buffer = new List<T>(); | |
foreach (var value in source) | |
{ | |
if (predicate(value)) | |
{ |
This file contains 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
/// <summary> | |
/// Viewbox 内に配置された要素について、実際に描画されているサイズを計算します。 | |
/// </summary> | |
public static Size GetRealSize(FrameworkElement target) | |
{ | |
var min = target.TranslatePoint(new Point(0, 0), Window.GetWindow(target)); | |
var max = target.TranslatePoint(new Point(target.ActualWidth, target.ActualHeight), Window.GetWindow(target)); | |
return (Size)(max - min); | |
} |
This file contains 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var controller = new BlyncLightController(); | |
var numberOfDevices = controller.InitBlyncDevices(); | |
if (numberOfDevices == 0) return; | |
try |
OlderNewer