In Winforms you can say
if ( DesignMode ) { // Do something that only happens on Design mode }
is there something like this in WPF?
Indeed there is:
System.ComponentModel.DesignerProperties.GetIsInDesignMode
Example:
using System.ComponentModel; using System.Windows; using System.Windows.Controls; public class MyUserControl : UserControl { public MyUserControl() { if (DesignerProperties.GetIsInDesignMode(this)) { // Design-mode specific functionality } } }
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