This question is locked. New answers and comments are not allowed.
Hi,
I've a ListBox which hasn't good performances with a lot of items, so I decided to use RadDataBoundListBox.
In my ListBoxItem, there are a CheckBox, an Image and a TextBlock. There are two possible Background colors for the ListBoxItem, depending on the state of the CheckBox (checked or unchecked).
Because when the Page started, some items have the CheckBox checked, and some others not (with the corresponding background colors), the SolidColorBrush is a property on the items in the ItemsSource collection.
To change the Background on the Checked and Unchecked events , I'm using the VisualStateManager.GoToState method.
Here is my ListBoxItem Style :
There is just an ItemContainerStyle, no ItemTemplate.
I tried the TargetTypes ("ListBoxItem") by "telerikPrimitives:RadDataBoundListBoxItem", build a specific ItemTemplate, but never had the same results as with the ListBox.
Thanks,
I've a ListBox which hasn't good performances with a lot of items, so I decided to use RadDataBoundListBox.
In my ListBoxItem, there are a CheckBox, an Image and a TextBlock. There are two possible Background colors for the ListBoxItem, depending on the state of the CheckBox (checked or unchecked).
Because when the Page started, some items have the CheckBox checked, and some others not (with the corresponding background colors), the SolidColorBrush is a property on the items in the ItemsSource collection.
To change the Background on the Checked and Unchecked events , I'm using the VisualStateManager.GoToState method.
Here is my ListBoxItem Style :
<Style x:Key="IT_Chaine_Style" TargetType="ListBoxItem"> <Setter Property="Background" Value="Transparent"/> <Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="Padding" Value="0"/> <Setter Property="HorizontalContentAlignment" Value="Left"/> <Setter Property="VerticalContentAlignment" Value="Top"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <Border BorderBrush="{StaticResource Border_Color2}" Width="432" BorderThickness="0,0,0,1"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CustomStates"> <VisualState x:Name="CustomUnselect"> <Storyboard> <ColorAnimation Storyboard.TargetName="Grid_Chaine" Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)" To="#99E7E7E7" Duration="0"/> </Storyboard> </VisualState> <VisualState x:Name="CustomSelect"> <Storyboard> <ColorAnimation Storyboard.TargetName="Grid_Chaine" Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)" To="#19E20031" Duration="0"/> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid Name="Grid_Chaine" Background="{Binding Background}" my:TiltEffect.IsTiltEnabled="True" Margin="0,1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <CheckBox Name="{Binding GetCbName}" IsChecked="{Binding IsMyChaine}" Checked="CB_IsMyChaine_Checked" Unchecked="CB_IsMyChaine_Unchecked" Margin="12,0,0,0" /> <Image Grid.Column="1" Source="{Binding Image}" Stretch="Uniform" Width="75" Height="75" CacheMode="BitmapCache" /> <TextBlock Grid.Column="2" Text="{Binding Nom}" VerticalAlignment="Center" Style="{StaticResource PhoneTextTitle2Style}" Foreground="{StaticResource PhoneForegroundBrush}" /> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style>There is just an ItemContainerStyle, no ItemTemplate.
I tried the TargetTypes ("ListBoxItem") by "telerikPrimitives:RadDataBoundListBoxItem", build a specific ItemTemplate, but never had the same results as with the ListBox.
Thanks,