Skip to content

Instantly share code, notes, and snippets.

@JohanLarsson
Last active August 29, 2015 14:06
Show Gist options
  • Save JohanLarsson/8b7ea47f49b5323548fe to your computer and use it in GitHub Desktop.
Save JohanLarsson/8b7ea47f49b5323548fe to your computer and use it in GitHub Desktop.
using System.ComponentModel;
using System.Windows;
using System.Windows.Data;
public class DesigntimeBinding : Binding
{
private static readonly DependencyObject _do = new DependencyObject();
public DesigntimeBinding(string path)
:base(path)
{
}
public object DesignTimeValue
{
set
{
if (DesignerProperties.GetIsInDesignMode(_do))
{
FallbackValue = value;
}
}
}
}
<Rectangle Fill="Blue" Width="{local:DesigntimeBinding Meh, DesignTimeValue=200}"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment