Option to activate debug mode in all pages
Closed this issue · 2 comments
Have you ever thought about the possibility to enable the Debug Mode in the whole app, setting random colors for every view in every page without the need of adding DebugRainbow.IsDebug="true
in the individual pages?
That could be a option you can enable in App.xml.cs
, by statically calling some method or variable of DebugRainbow to set the debug in all pages, and it would run whenever a new page is open. Is that possible?
If you could give me directions I may try and create a pull request over the next days. ;)
Sorry for not getting back to you earlier! Since it's an attached property one can set on ContentPage and the initialization of content pages might differ based on the MVVM framework you use this could get tricky. Looking at a way to get something like the following to work:
<Style TargetType="ContentPage">
<Setter Property="debug:DebugRainbow.IsDebug" Value="true" />
</Style>
or...
<Style x:Key="debugPage" TargetType="ContentPage">
<Setter Property="debug:DebugRainbow.IsDebug" Value="true" />
</Style>
<Style TargetType="ContentPage">
<Setter Property="Style" Value="{StaticResource debugPage}" />
</Style>
This should work:
<Style ApplyToDerivedTypes="True" TargetType="ContentPage">
<Setter Property="debug:DebugRainbow.IsDebug" Value="false" />
</Style>