如何指定某些XAML元素只应在设计模式下显示?

时间:2016-10-12 19:39:41

标签: c# wpf xaml

是否有一些特殊的XML标记或属性可以添加到我的XAML中,以使<UserControl ...> <Grid> <IfDesignMode> <Show-This-Element-Only-In-Design-Mode /> </IfDesignMode> </Grid> </UserControl> 上的某些子元素仅出现在设计模式中?像这样的东西?

LEFT JOIN

1 个答案:

答案 0 :(得分:0)

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

要获得进一步的帮助,请访问this获取更多帮助