This is a migrated thread and some comments may be shown as answers.

ItemContainerStyleSelector not working

4 Answers 170 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Adrien
Top achievements
Rank 1
Adrien asked on 28 May 2013, 11:56 AM
Hello,

The ItemContainerStyleSelector on the RadListBox is not working.

Here is what I did:

public class SpeakerStyleSelector : StyleSelector
    {
        public Style NoEmailSpeakerStyle { get; set; }
 
        public override Style SelectStyle(object item, DependencyObject container)
        {
            if (item is Speaker)
                return this.NoEmailSpeakerStyle;
 
            return null;
        }
    }
}



<Style x:Key="NoEmailSpeakerItemContainerStyle" TargetType="telerik:RadListBoxItem">
     <Setter Property="Foreground" Value="Red"/>
</Style>
         
<local:SpeakerStyleSelector x:Key="SpeakerItemContainerStyleSelector"
                    NoEmailSpeakerStyle="{StaticResource NoEmailSpeakerItemContainerStyle}"/>
 
 
...
 
 
<telerik:RadListBox   ItemsSource="{Binding Speakers}"
               ItemContainerStyleSelector="{StaticResource SpeakerItemContainerStyleSelector}" />

The SelectStyle method is never called.

BTW, if I set directly the NoEmailSpeakerItemContainerStyle with the ItemContainerStyle, it works fine!



Regards,
Adrien.

4 Answers, 1 is accepted

Sort by
0
Accepted
Kalin
Telerik team
answered on 29 May 2013, 09:20 AM
Hello Adrien,

We've tried the provided code but we didn't manage to reproduce the issue using our latest release (Q1 2013 SP1) - the SelectStyle method was called correctly at our side. Can you confirm that you're using the latest version of the controls? Also any additional information about the exact scenario you could provide, will be helpful.

I'm looking forward to your response.

Regards,
Kalin
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Adrien
Top achievements
Rank 1
answered on 29 May 2013, 09:46 AM
I wasn't using the lastest version.

I got the Q3 2012 and it works fine.


Thanks.
0
Bruno
Top achievements
Rank 1
answered on 18 Apr 2016, 01:56 PM

Hi Telerik

Could it be possible that the ItemContainerStyleSelector again didn't working on the RadListBox?
I'm using the actual Version of the Telerik Controls für Silverlight.

Kind regards,
Bruno

0
Kalin
Telerik team
answered on 19 Apr 2016, 01:48 PM
Hello Bruno,

We are not aware of any issues with the ItemContainerStyleSelector of RadListBox. Can you please share some more details regarding the exact scenario and issue you are observing?

I'm looking forward to hearing from you.


Regards,
Kalin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
ListBox
Asked by
Adrien
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Adrien
Top achievements
Rank 1
Bruno
Top achievements
Rank 1
Share this question
or