DataPager EventArgs

I am using a DataPager control in a silverlight application. I have different pagers for different DataGrids and you want to use the same event handler for the PageIndexChanged event for all of them. The delegate must accept the EventArgs object as an argument. Can I use this object to "return" to the control from which the event was fired?

+5
source share
3 answers

I swear I tried this before switching to f # 4 and silverlight 4, and it did not work, but now it happens ...

http://connect.microsoft.com/VisualStudio/feedback/details/524645/f-add-event-handler-to-form-anonymous-function-is-required

+1
source

The sender parameter is a reference to the object that triggered the event.

So, if you want to get to DataPager, this should do it: -

 DataPager dp = (DataPager)sender;
0
source

F #:

1

let pageIndexChanged (args : EventHandler<EventArgs>) = 
    // Do something
    ()

pager.PageIndexChanged.AddHandler(pageIndexChanged)

, EventHandler
EventHandler → unit

2

let pageIndexChanged (args : EventArgs) = 
    // Do something
    ()

pager.PageIndexChanged.Add(pageIndexChanged)

, args

0

All Articles