Skip to main content
Home Forums General Silverlight New Features in Silverlight 3 Applying themes to a listbox
2 replies. Latest Post by mehtapratik on July 1, 2009.
(0)
wpegg
Member
4 points
5 Posts
04-15-2009 5:29 AM |
Hi,
Has anyone tried using themes from the silverlight toolkit on a listbox. The simple example below fails to display the items, however if I remove the theme tag it works fine. In a more complicated example with binding etc. I get the error "Unable to cast object of type 'System.Windows.Controls.ContentControl' to type 'System.Windows.Controls.ListBoxItem'." when I update my datasource with new data.
<UserControl x:Class="SLTest.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:theme="clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.BureauBlack" Width="400" Height="300"> <Grid x:Name="LayoutRoot" Background="White"> <theme:BureauBlackTheme> <ListBox ItemsSource="LotsOfLetters" x:Name="lstTest"></ListBox> </theme:BureauBlackTheme> </Grid></UserControl>
Thanks,
Will
mehroz
409 points
88 Posts
06-30-2009 6:17 AM |
I am getting the same error, and my listbox is decorated with BureauBlue theme. Were you able to resolve this?
Also, I noticed that this error occurs on machines with Silverlight 3 Beta installed, it works fine on systems running Silverlight 2. Are you experiencing the same?
Regards,
mehtapratik
269 points
302 Posts
07-01-2009 3:05 AM |
did you find the solution?? I am getting the same error..