Get RadDataBoundListBox object from LoadMore button

2 posts, 0 answers
  1. bento
    bento avatar
    35 posts
    Member since:
    Aug 2013

    Posted 02 Oct 2013 Link to this post

    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>

  2. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 02 Oct 2013 Link to this post

    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



  3. DevCraft banner
Back to Top