Databoundlistbox - Can't select some items

8 posts, 0 answers
  1. Dele
    Dele avatar
    23 posts
    Member since:
    Jun 2012

    Posted 17 Mar 2011 Link to this post

    I recently switched some of my Listboxes to use the new Telerik DataBoundListBox.  However, I am coming across a problem.  I can't seem to click on some of the items in my list.  And it does not throw an error either.  Please this is urgent.  Thanks.

    Please see below sample code:

    <telerikPrimitives:RadDataBoundListBox CacheMode="BitmapCache" x:Name="lbRecentAlerts" Grid.Row="1"  
                                           ItemsSource="{Binding RecentAlerts}" 
                                           SelectedItem="{Binding SelectedAlert, Mode=TwoWay}"
                                           ItemTemplate="{StaticResource AmberAlertListTemplate}">
        <telerikPrimitives:RadTransitionControl.Transition>
            <telerikPrimitives:RadTileTransition />
        </telerikPrimitives:RadTransitionControl.Transition>
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="SelectionChanged">
                <mvvmLightCommand:EventToCommand Command="{Binding GoToAlertCommand, Mode=OneWay}"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>                        
    </telerikPrimitives:RadDataBoundListBox>
  2. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 17 Mar 2011 Link to this post

    Hello Dele,

    We are not aware of such problem. To reproduce it we will need your help:
    1. Can you replace the telerik listbox with the standard listbox and check if the problem is gone. Just to make sure that the problem is really coming from the Telerik listbox.
    2. You can subscribe to the ItemTap event and see if the event is raised
    3. You can subscribe to the MouseLeftButtonDown event of the DataBoundListBox to see if the control gets any input from the framework.
    4. Check if there is something that is above the databound listbox and "eats" the tap events.

    If none of these help - can you provide us with the whole solution where the problem is reproducible and we can investigate the problem on our own?

    Best wishes,

    Valentin.Stoychev
    the Telerik team

     

    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Dele
    Dele avatar
    23 posts
    Member since:
    Jun 2012

    Posted 17 Mar 2011 Link to this post

    Thanks for the quick reply.  I'll try all the steps listed below.  However, I am able to click on some of the items, but not all of them in the listbox

    What is the best way to handle calling commands to the View model with the Databound list box?  Is what i have in my code snippet good?
  5. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 17 Mar 2011 Link to this post

    Hello Dele,

    Your solution is OK - there is no good comanding mechanism in WP7, and MVVMLight is one of the best solutions for this out there.

    BTW: Can you also try using the ItemTap event in your event trigger instead of the SelectionChanged, to see if this will fix your problem.

    Kind regards,
    Valentin.Stoychev
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  6. Dele
    Dele avatar
    23 posts
    Member since:
    Jun 2012

    Posted 17 Mar 2011 Link to this post

    Ok.  ItemTap event seems to solve my problem.  Thanks for your help.  i'll probably do tiny blog post about it for anyone else who may be using MVVM Light and the DataBoundListBox.

    the code now looks like this.

    <telerikPrimitives:RadDataBoundListBox CacheMode="BitmapCache" x:Name="lbRecentAlerts" 
                                                               ItemsSource="{Binding RecentAlerts}"
                                                               SelectedItem="{Binding SelectedAlert, Mode=TwoWay}"
                                                               ItemTemplate="{StaticResource AmberAlertListTemplate}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="ItemTap">
                                    <mvvmLightCommand:EventToCommand Command="{Binding GoToAlertCommand, Mode=OneWay}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>                       
                        </telerikPrimitives:RadDataBoundListBox>
  7. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 18 Mar 2011 Link to this post

    Hi Dele,

    This is not a normal behavior. Can you send us the complete project so we can investigate. Also are you sure you are not clicking on already selected item? If you click on already selected item the selection change event will not be raise - thus your command will not execute.

    Greetings,
    Valentin.Stoychev
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  8. Dele
    Dele avatar
    23 posts
    Member since:
    Jun 2012

    Posted 18 Mar 2011 Link to this post

    Hi.

    Yes, it's definitely not because the item is already selected.  As soon as the listbox loads, some of the items are already unselectable.

    I went ahead and created the ticket for it.  And you'll find my project attached.

    Thanks again.
  9. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 19 Mar 2011 Link to this post

    Hi Dele,

    For further information on this case please refer to the ticket you have opened.

    Thanks for your time.

    Best wishes,
    Deyan
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top
DevCraft banner