Applying any theme causes DataTemplate to fail

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 12 years ago by Ed Starkey
Version: 11.2.0554

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">
                                    <StackPanel HorizontalAlignment="Center" ToolTip="{Binding TestDescription}" Margin="0,5" Height="70">
                                        <Image Source="{Binding TestIcon}" Width="50" Stretch="UniformToFill"/>
                                        <Label Content="{Binding TestName}"/>                                        

 In my App.xaml.cs code I have basic Theme assignment.

protected override void  OnStartup(StartupEventArgs e)

               ThemeManager.AreNativeThemesEnabled = true;

               ThemeManager.CurrentTheme = ThemeName.AeroNormalColor.ToString();




 If I leave out the ThemeManager.EndUpdate(), My DataTemplate works fine.

Any suggestions?

Comments (2)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Ed,

If you can please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.

Actipro Software Support

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Ed,

Thank you for the sample application. The issue here has to do with the fact that you have enabled our Native Themes support *and* you are using a ListView like a ListBox. The ListView derives from ListBox and adds a "view", of which there is currently only a GridView that can be used. Assuming you don't set the View property, your ListView is effectively nothing more than a ListBox. If you set the View property to a GridView, then you can specify columns etc.

Due to how the ListView specifies it's default themes, we had to make the decision of whether to style the ListView with or without the GridView (as it would not be possible to support both as the default styles do). We chose the former, because if you don't have a View you can use a ListBox instead and get the same resulting UI.

So in your case above, you can replace the ListView with a ListBox. Alternatively, you could specify a GridView with appropriate columns and it would work as well.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.