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>
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>