Skip to main content

Microsoft Silverlight

Applying themes to a listboxRSS Feed

(0)

wpegg
wpegg

Member

Member

4 points

5 Posts

Applying themes to a listbox

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
mehroz

Member

Member

409 points

88 Posts

Re: Applying themes to a listbox

 Hi,

 

 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,

Syed Mehroz Alam

My Blog | My Articles

mehtapratik
mehtapratik

Member

Member

269 points

302 Posts

Re: Re: Applying themes to a listbox

 did you find the solution?? I am getting the same error..

Pratik Mehta
Espirit Softwares Pvt. Ltd.
India.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities