0

Is there some special XML tag or property I can add to my XAML to make certain child elements on a UserControl only appear in Design Mode? Something like this?

<UserControl ...>
    <Grid>
        <IfDesignMode>
            <Show-This-Element-Only-In-Design-Mode />
        </IfDesignMode>
    </Grid>
</UserControl>
soapergem
  • 9,263
  • 18
  • 96
  • 152
  • May be [this question](http://stackoverflow.com/questions/834283/is-there-a-way-to-check-if-wpf-is-currently-executing-in-design-mode-or-not) can help you – Mat J Oct 14 '16 at 12:16

1 Answers1

0
using Caliburn.Micro;
public SomeViewModel()
{    
if(Execute.InDesignMode)
{
    //write some code here
    UIelementName.Visibility = System.Windows.Visibility.Hidden
}}

for further help visit this for more help

Community
  • 1
  • 1
Raviteja Narra
  • 458
  • 3
  • 11
  • That only applies if you're using Caliburn.Micro – stwalkerster Oct 14 '16 at 10:40
  • yes it can only be used if Caliburn.Micro is being used. but thats one of the easiest ways of doing it. – Raviteja Narra Oct 14 '16 at 10:46
  • Adding a whole new dependency to a project for something as minor as this does not seem like a sensible way to go, especially when there are other (native) ways of doing it like other answers on your link suggest. – stwalkerster Oct 14 '16 at 10:50
  • You can use `DesignerProperties.GetIsInDesignMode(this);` to find out whether or not you're executing in design mode. This requires no dependencies. – Logix Nov 03 '20 at 05:24