![Avatar](https://secure.gravatar.com/avatar/3499071ee8a8545e99b2f30e9f59f876.jpg?s=64&d=identicon&r=g)
Setting CurrentTheme doesn't work in MsTest & does work in normal run.
Window :
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"
Title="Window1" Height="300" Width="300">
<Grid>
<TextBlock Text="This is a test"
Background="{DynamicResource {x:Static themes:ExplorerBarCommonDictionary.BackgroundBrushKey}}"/>
</Grid>
</Window>
Code :
Partial Public Class Window1
Protected Overrides Sub OnInitialized(ByVal e As System.EventArgs)
MyBase.OnInitialized(e)
Try
'ActiproSoftware.Windows.Themes.ThemeManager.CurrentTheme = "Office2007Black"
'=> Runtime error in MsTest, Ok in normal run.
ActiproSoftware.Windows.Themes.ThemeManager.SetTheme(Me, "Office2007Black")
'=> both ok
Catch ex As Exception
End Try
End Sub
End Class
So, why does setting CurrentTheme doesn't work in MsTest ?
Window :
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"
Title="Window1" Height="300" Width="300">
<Grid>
<TextBlock Text="This is a test"
Background="{DynamicResource {x:Static themes:ExplorerBarCommonDictionary.BackgroundBrushKey}}"/>
</Grid>
</Window>
Code :
Partial Public Class Window1
Protected Overrides Sub OnInitialized(ByVal e As System.EventArgs)
MyBase.OnInitialized(e)
Try
'ActiproSoftware.Windows.Themes.ThemeManager.CurrentTheme = "Office2007Black"
'=> Runtime error in MsTest, Ok in normal run.
ActiproSoftware.Windows.Themes.ThemeManager.SetTheme(Me, "Office2007Black")
'=> both ok
Catch ex As Exception
End Try
End Sub
End Class
So, why does setting CurrentTheme doesn't work in MsTest ?