On Nov 19, 2011, at 8:38 PM, Paul F. Johnson wrote:
> Should I still be using a listener and if so, how?

Yes, set via the DatePicker.Init() method:

        
http://androidapi.xamarin.com/monodoc.ashx?link=M%3aAndroid.Widget.DatePicker.Init(System.Int32%2cSystem.Int32%2cSystem.Int32%2cAndroid.Widget.DatePicker.IOnDateChangedListener)

You'll need to implement the DatePicker.IOnDateChangedListener interface:

        class DateChangedListener : Java.Lang.Object, 
DatePicker.IOnDateChangedListener {

                Action<DatePicker, int, int, int> callback;

                public DateChangedListener (Action<DatePicker, int, int, int> 
callback)
                {
                        this.callback = callback;
                }

                public void OnDateChanged (DatePicker view, int year, int 
monthOfYear, int dayOfMonth)
                {
                        callback (view, year, monthOfYear, dayOfMonth);
                }
        }

I don't know what context you need, but to use the above you would:

        DatePicker dp = ...;
        dp.Init (2011, 11, 30, new DateChangedListener ((picker, year, month, 
day) => {
                        // ...
        }));

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to