Help with VB on Radcontrols?

2 posts, 0 answers
  1. Damien
    Damien avatar
    6 posts
    Member since:
    Sep 2012

    Posted 22 Mar 2013 Link to this post

    I'm having trouble with using Radcontrols for WP in VB.net (VS Express 2012).

    I don't know C# well enough to convert the code samples given in the documentation. Specifically I'm trying out the Looping List control.

    This code is causing me trouble (and online converters don't produce working code either). I just need to populate my loop control with some data:
    LoopingListDataSource src = new LoopingListDataSource(10);
    src.ItemNeeded += (sender, args) =>
    {
        args.Item = new LoopingListDataItem(args.Index.ToString());
    };
    src.ItemUpdated += (sender, args) =>
    {
        args.Item.Text = args.Index.ToString();
    };

    It's this stuff that is causing me trouble. I'm not sure how to restructure it to VB.net.
    src.ItemNeeded += (sender, args) =>
     
    {
     
        args.Item = new LoopingListDataItem(args.Index.ToString());
     
    };


    Could I please get some help converting the above to VB.net so I can test the controls?


  2. Damien
    Damien avatar
    6 posts
    Member since:
    Sep 2012

    Posted 22 Mar 2013 Link to this post

    Yay for me, I figured it out!

    For future reference if anyone else needs the answer, I had to add handlers (see below). I should be able to populate the data with my own values now.

    Public Sub New()

    Dim
    src As LoopingListDataSource = New LoopingListDataSource(10)
     
           AddHandler src.ItemNeeded, AddressOf src_ItemNeeded
           AddHandler src.ItemUpdated, AddressOf src_ItemUpdated
     
           looper.DataSource = src
     
       End Sub
     
       Private Sub src_ItemNeeded(sender As LoopingListDataSource, args As LoopingListDataItemEventArgs)
           args.Item = New LoopingListDataItem(args.Index.ToString())
     
       End Sub
       Private Sub src_ItemUpdated(sender As LoopingListDataSource, args As LoopingListDataItemEventArgs)
           args.Item = New LoopingListDataItem(args.Index.ToString())
     
       End Sub
  3. DevCraft banner
Back to Top