Design-time-only background color in WPF?

前端 未结 5 962
伪装坚强ぢ
伪装坚强ぢ 2020-12-13 03:53

In WPF XAML there is the convenient DesignHeight and DesignWidth, for instance in code as



        
5条回答
  •  没有蜡笔的小新
    2020-12-13 04:23

    There's an undocumented property d:DesignStyle of type Style that you can set on a user control. This style is only applied in the designer and is not used at runtime.

    You use it like this:

    
    

    Or like this:

    
        
            
        
    
    

    Note however that any value set on the Style property (the one used at runtime) will also override the DesignStyle in the designer.

提交回复
热议问题