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

Get RadDataBoundListBox object from LoadMore button

1 Answer 28 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.
bento
Top achievements
Rank 2
bento asked on 02 Oct 2013, 07:42 AM
Hi,

Do you know how to get "listBound" object from inside "btnLoadMore_Click" method ? Because the sender as Button, have a parent = null.

<telerikPrimitives:RadDataBoundListBox x:Name="listBound">
    <telerikPrimitives:RadDataBoundListBox.DataVirtualizationItemTemplate>
        <DataTemplate>
            <Button x:Name="btnLoadMore"
                    Tap="btnLoadMore_Click" />
        </DataTemplate>
    </telerikPrimitives:RadDataBoundListBox.DataVirtualizationItemTemplate>
</telerikPrimitives:RadDataBoundListBox>

1 Answer, 1 is accepted

Sort by
0
MasterChiefMasterChef
Top achievements
Rank 2
answered on 02 Oct 2013, 03:00 PM
Hi bento,

You should be able to access the RadDataBoundListBox in the code behind simply by typing its Name property. You can then use the properties and methods of the RadDataBoundListBox object.

private void btnLoadMore_Click(object sender, RoutedEventArgs e){
       //to access list box in the code behind, simply type its Name property and you will be able to access its properties and methods.
       //ObjectBoundToListBox is the object you are binding to the DataBoundListBox
        var selectedObject = (listBound.SelectedItem as ObjectBoundToListBox);
  
       //you can now use the ObjectBoundToListBox and its properties and methods.
       int number = selectedObject.CustomProperty;
}

If you need to learn how to bind data to a RadDataBoundListBox, take a look at the documentation:
http://www.telerik.com/help/windows-phone/raddataboundlistbox-getting-started.html

Good luck,
Master Chief



Tags
DataBoundListBox
Asked by
bento
Top achievements
Rank 2
Answers by
MasterChiefMasterChef
Top achievements
Rank 2
Share this question
or