ItemContainerStyleSelector not working

3 posts, 0 answers
  1. Lars-Erik
    Lars-Erik avatar
    4 posts
    Member since:
    Aug 2011

    Posted 19 Mar 2012 Link to this post

    Hi! 
    I'm having trouble getting the ItemContainerStyleSelector feature on the RadListBox working. Has this feature been fully implemented? I'm using version 2012.1.306.1050 of the telerik library.

    Source code below...

    <telerik:RadListBox x:Name="structureListBox" ItemContainerStyleSelector="{StaticResource StructureListBoxItemContainerStyleSelector}" ItemsSource="{Binding Path=StructureNodes}" ItemTemplate="{StaticResource StructureListItemTemplate}" Style="{StaticResource StructureListBoxStyle}" />                 

    <local:StructureNodeItemContainerStyleSelector x:Key="StructureListBoxItemContainerStyleSelector"
                                                                ControllerStyle="{StaticResource StructureListBoxControllerNodeStyle}"
                                                               FolderStyle="{StaticResource StructureListBoxFolderNodeStyle}"/>

       public class StructureNodeItemContainerStyleSelector : StyleSelector
        {
            public Style FolderStyle { get; set; }
            public Style ControllerStyle { get; set; }


            public override Style SelectStyle(object item, DependencyObject container)
            {
                if (item is FolderNode)
                    return FolderStyle;
                return ControllerStyle;
            }
        }

        <Style x:Key="StructureListBoxControllerNodeStyle" TargetType="telerik:RadListBoxItem">
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="VerticalContentAlignment" Value="Top"/>      
            <Setter Property="Background" Value="#FFFFFFFF"/>
            <Setter Property="BorderBrush" Value="#FF878686"/>
            <Setter Property="Margin" Value="0"/>      
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Padding" Value="5 0 5 0"/>
            <Setter Property="TabNavigation" Value="Local"/>
        </Style>

     <Style x:Key="StructureListBoxFolderNodeStyle" TargetType="telerik:RadListBoxItem">
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="VerticalContentAlignment" Value="Top"/>
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1.021" StartPoint="0.5,0.027">
                        <GradientStop Color="White" Offset="0"/>
                        <GradientStop Color="#FFC9C9CC" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="BorderBrush" Value="#FF999999"/>
            <Setter Property="Margin" Value="0"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="5 0 5 0"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="TabNavigation" Value="Local"/>
        </Style>

  2. Andy
    Andy avatar
    5 posts
    Member since:
    Jul 2010

    Posted 20 Mar 2012 Link to this post

    Same here. It just doesn't work for me. I just restructured all my stuff for this too :(
  3. DevCraft banner
  4. George
    Admin
    George avatar
    1332 posts

    Posted 22 Mar 2012 Link to this post

    Hello,

     
    We can confirm that the RadListBox control doesn't support this functionality as CTP, but it will be implemented for the final version (Q2 release). 

    All the best,
    George
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top