How would i be able to use the GetIsInDesignMode from inside a converter? It seems that the method requires the parent user control/window, a variable which is not accessible when inside a converter.
Example :
public class CellImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (DesignerProperties.GetIsInDesignMode(??))
..
..
Thanks
I came across a few answers searching for "DesignerProperties wpf". This method from http://sweux.com/blogs/laranjeira/index.php/wpf/design-mode-wpf/how-to-get-design-mode-property-in-wpf/ is quite simple.
DesignerProperties.GetIsInDesignMode(new DependencyObject());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With