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

Manual OnDemand DataboundListbox

2 Answers 97 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.
Dele
Top achievements
Rank 2
Dele asked on 24 Aug 2011, 10:55 PM
I have wired up my listbox with the "OnDemandManual" virtualization mode, along with a data virtualization item template like so.
<telerikPrimitives:RadDataBoundListBox x:Name="lbJobSearchResults"
                                                   telerikCore:InteractionEffectManager.IsInteractionEnabled="True"
                                                   EmptyContent=" "
                                                   ItemsSource="{Binding JobSearchResults}"
                                                   ItemTemplate="{StaticResource SearchResultListTemplate}"
                                                   SelectedItem="{Binding SelectedJobResult, Mode=TwoWay}"
                                                   DataVirtualizationMode="OnDemandManual">
                <telerikPrimitives:RadDataBoundListBox.DataVirtualizationItemTemplate>
                    <DataTemplate>
                        <Button Margin="-12, 0, -12, 0"
                                Content="load more"
                                HorizontalAlignment="Stretch"
                                x:Name="btnLoadMore"
                                Command="{Binding LoadMoreJobsCommand, Mode=OneWay}" />
                    </DataTemplate>
                </telerikPrimitives:RadDataBoundListBox.DataVirtualizationItemTemplate>

As you can see, I would like to fire off a command when i click on the load more button.  but the command doesn't even seem to be registering.  is this possible via commanding, or do I need to call the command via my code-behind?

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 26 Aug 2011, 10:26 AM
Hi Dele,

Thank you for contacting us.

In order to have the proper DataContext passed to the underlying ContentControl that visualizes the DataVirtualizationItemTemplate , you should also set the DataVirtualizationItemContent property to the view model that contains the command instance:

<telerik:RadDataBoundListBox x:Name="radListBox" DataVirtualizationMode="OnDemandManual" DataVirtualizationItemContent="{Binding}">

Still, this code will not work, because I have found a bug with updating the Content property. I would like to thank you for bringing our attention to this issue. Your Telerik points are updated as a token for our gratitude for your time and feedback.

The bug will be fixed in the next internal build (available within a week or two). Currently you may use a StaticResource binding and set the Command property as a local value of the button.

Once again - thanks for your feedback. Do not hesitate to contact us with any question/problem you may have with our tools.

All the best,
Georgi
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Dele
Top achievements
Rank 2
answered on 28 Aug 2011, 08:38 PM
Thanks for the info Georgi.

I already have a workaround, but will look forward to when this is available.
Tags
DataBoundListBox
Asked by
Dele
Top achievements
Rank 2
Answers by
Georgi
Telerik team
Dele
Top achievements
Rank 2
Share this question
or