
I have working code that pulls data from a ViewModel and then displays it in my View by means of a DataTemplate. Whenever I apply a Theme using ThemeManager, my DataTemplate Fails. I am just applying the Actipro supplied themes.
My XAML is nothing special
<docking:ToolWindow Title="Test" x:Name="testToolBar" Width="200">
<ListView Name="testListView" DataContext="{Binding Source={StaticResource TestTypeViewModelDataSource}}" ItemsSource="{Binding AvailableTest}" HorizontalContentAlignment="Stretch">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Center" ToolTip="{Binding TestDescription}" Margin="0,5" Height="70">
<Image Source="{Binding TestIcon}" Width="50" Stretch="UniformToFill"/>
<Label Content="{Binding TestName}"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</docking:ToolWindow>
In my App.xaml.cs code I have basic Theme assignment.
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
ThemeManager.BeginUpdate();
try
{
ThemesOfficeThemeCatalogRegistrar.Register();
ThemeManager.AreNativeThemesEnabled = true;
ThemeManager.CurrentTheme = ThemeName.AeroNormalColor.ToString();
}
finally
{
ThemeManager.EndUpdate();
}
}
If I leave out the ThemeManager.EndUpdate(), My DataTemplate works fine.
Any suggestions?