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

Bugs with the selection when selecting multiple element

2 Answers 50 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sébastien
Top achievements
Rank 2
Iron
Iron
Iron
Sébastien asked on 12 Mar 2013, 03:02 AM
Hello,

I have a simple list with a small DataTemplate (Image + Text):

<telerikPrimitives:RadDataBoundListBox Grid.Row="2"
                                                       EmptyContent=""
                                                       Margin="12,0,0,0"
                                                       ItemsSource="{Binding Spotlights}"
                                                       SelectedItem="{Binding SelectedSpotlight, Mode=TwoWay}"
                                                       x:Name="ListSpotlights">
 
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <cal:ActionMessage MethodName="SelectApplication">
                                <cal:Parameter Value="{Binding SelectedItem, ElementName=ListSpotlights}" />
                            </cal:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
 
                    <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                        <DataTemplate>
 
                            <Grid Margin="{Binding IsLastItem, Converter={StaticResource SpotlightItemMarginConverter}}">
 
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
 
                                <Image Width="99"
                                       Height="99"
                                       Source="{Binding ImageUrl}"
                                       VerticalAlignment="Top" />
 
                                <TextBlock Grid.Column="1"
                                           FontSize="{StaticResource PhoneFontSizeLarge}"
                                           FontFamily="{StaticResource PhoneFontFamilyLight}"
                                           Margin="12,0,0,0"
                                           MaxHeight="90"
                                           Text="{Binding Name}"
                                           TextWrapping="Wrap"
                                           VerticalAlignment="Center" />
 
                            </Grid>
 
                        </DataTemplate>
                    </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
 
                </telerikPrimitives:RadDataBoundListBox>

I'm using the standard OS theme color for my app (so it will be displayed nice with dark and light themes).

The RadDataListBox is missing a property like SelectionMode (None, Single, Multi). When I click on a item, I'm launching a page. I was observing that when coming back to the list and selecting the same item again, it didn't work. I found another thread where you suggest to set the SelectedItem to null. It works, but it does not reset the color of the selected item, it seems a bug.

The second bug is closely related to the previous one: if I select other items, the text uses again the theme color, so I can have in my list 4 items with the red color by example.

Thank you
ArchieCoder

2 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 13 Mar 2013, 12:10 PM
Hello Sebastien,

Thanks for writing.

I am not quite sure why are you using the SelectionChanged event to navigate to another page. You can simply handle the ItemTap event which is fired each time the user taps on an item. If you want to disable the selection color for the visual items, you can either handle the SelectionChanging event and cancel the selection or simply override the foreground color within your Item Template.

I hope this helps.

Greetings,
Deyan
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Sébastien
Top achievements
Rank 2
Iron
Iron
Iron
answered on 14 Mar 2013, 01:30 AM
Hi,

Thank you for the answer. In fact, using ItemTap fixed both problems! I was not aware of this event, I was used to SelectionChanged with WP lists.

Regards
ArchieCoder
Tags
DataBoundListBox
Asked by
Sébastien
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Deyan
Telerik team
Sébastien
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or