Create properties that only apply on design time

后端 未结 2 1105
情书的邮戳
情书的邮戳 2020-12-19 05:21

I am using visual studio dark theme. As a result when designing my views I cannot see the font if its black. A fix will be to set the background of the view to white. But ou

2条回答
  •  不知归路
    2020-12-19 05:57

    Not sure if it's exactly what you're looking for, but what I do is just plop a trigger in the app.xaml to invoke using the IsInDesignMode property like;

    Namespace (Thanks Tono Nam);

    xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=PresentationFramework"

    XAML;

    
    

    Simple, but works, and sometimes I target other dependency properties like font and stuff too depending on the need. Hope this helps.

    PS - You can target other TargetType's with their own properties the same way, like for example, ChildWindows, Popups, Windows, whatever...

提交回复
热议问题